SEG3420 File Structures and Processing - Lecture4 Data Transfers
SEG3420 File Structures and Processing - Lecture4 Data Transfers
• Hardware
• Operating Systems
Hardware
- Overview
Primary CPU
Memory
Channel
Controller Secondary
Memory
Hardware
- Primary Storage 1/2
Arithmetic/Logic Unit
Primary
Registers
Storage
Control Unit
Bus
Hardware
- Central Processing Unit (CPU) 3/3
• Purposes
– Relieve the CPU of data transfer management
• A channel
– is a special processor with its own instruction set,
instruction counter, and control logic
– is for relieving the CPU from data transfer tasks
• CPU may execute instructions directly from
cache memory for efficiency
Hardware
- Channel 2/7
Perform a “seek”;
Find the correct block;
Write the block from address;
Hardware
- Channel 4/7
• Types of channels
– Selector
– Byte Multiplexor
– Block Multiplexor
Hardware
- Channel 5/7
• Selector Channel
– Can connected as many as 256 devices
– Only one can be selected
– The physical I/O operations are completed in
sequence
– Usually use with high-speed devices
Hardware
- Channel 6/7
CPU
Interprets and executes the channel
commands to the connected secondary
Channel
storage device
Controller Controller
R0 R0
WRITE request
R1 R1
R2 R2
Primary Storage
Operating Systems
- An Overview
Device Management
Memory Management
Processor Management
Operating Systems
- The Four Primary Components 2/6
• Memory Management
– Allocate and release storage area to processes
– Storage area allocation management
Operating Systems
- The Four Primary Components 3/6
• Processor Management
– There are three components
• Job scheduler: Decides which jobs are allowed
• Processor scheduler: Decides in which order and for how
long the processor will be dedicated to jobs submitted to
the system
• Traffic controller: Keeps track of the processors and
processes status
Operating Systems
- The Four Primary Components 4/6
– Scheduling algorithms
• First Come, First Serve (FCFS) Policy: The first job gains
control until it is finished
• Shortest Job Next (SJN): The job that needs the least
processor time will be processed next
• Great improvement
• Question: What if new jobs with less than 100 µs processing
time arrive before the third job is executed?
Operating Systems
- The Four Primary Components 6/6
• SCAN
– The R/W head moves in one specific direction at a
particular time
– All requests over which the R/W head passes through will
be served
Operating Systems
- Device Management Component 4/5
SR 1 10 2 100 3 5 4 95 .
FCFS
SR . 3 5 1 10 4 95 2 100 .
SCN
SR . 3 5 1 10 4 95 2 100 .
SCAN
Operating Systems
- Device Management Component 5/5
• Purposes
– File management
• Keep track of
– Physical file locations
– File usages
– File status
– File opening and closing
– Storage allocation
– I/O buffers
– Secondary devices and their characteristics
Operating Systems
- Data Management Component 2/17
• The Directory
– Each system maintain a master directory referred to
as the system directory
– Files are accessed through their pathname
– Directories are files
Operating Systems
- Data Management Component 6/17
Root
File3 File4
Operating Systems
- Data Management Component 7/17
– File Map
• A file of logical records is created for each file
– There is a one-to-one correspondence between the logical
records and the blocks in the file
– Each logical record consists of two fields about the information
of the corresponding block
» First field: Length of the block
» Second field: Address of the block
• The designer is responsible for choosing the most efficient
structure for the file map
Operating Systems
- Data Management Component 13/17
• I/O Buffers
– Two pairs of pointers for I/O buffers are maintained
by the file system
• Input buffer pointer (IBP) / Output buffer pointer (OBP)
• Current input buffer pointer (CIBP) / Current output buffer
pointer (COBP)
Operating Systems
- Data Management Component 14/17
Algorithm logical_READ;
If (IBP == CIBP)
{
Perform a physical_READ;
while (transfer_not_completed)
wait;
}
Deliver logical record pointed to by CIPB to indicate program
variable;
CIPB = CIPB + Length(delivered logical record);
If (CIPB == IPB + Size(Buffer))
CIPB = IBP;
Operating Systems
- Data Management Component 15/17
IBP
CIBP
Input Buffer
Data Area
SD R0 R1 R2
First Block
Output Buffer
Operating Systems
- Data Management Component 16/17
IBP R0
CIBP R1
R2
Input Buffer
R0
Data Area
SD R0 R1 R2
First Block
Output Buffer
Operating Systems
- Data Management Component 17/17
IBP R0
R1
CIBP R2
Input Buffer
R0
Data Area
COBP
SD R0 R1 R2
First Block
Output Buffer
References