Professional Documents
Culture Documents
Unit5 DrCSYadav
Unit5 DrCSYadav
Greater Noida
Operating System
KCS401
Unit: 5
OPERATING SYSTEM(KCS-401)
CODE PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
KCS401.1 3 3 2 2 1 2 - 2 3 2 2 3
KCS401.2 3 3 3 2 2 3 2 2 3 - 1 3
KCS401.3 3 3 2 2 2 2 2 2 2 3 1 3
KCS401.4 3 2 2 3 1 2 2 - 2 - 2 3
KCS401.5 3 1 2 2 2 2 - - 2 2 2 3
KCS401.1 2 1 2 2
KCS401.2 2 2 1 2
KCS401.3 2 3 3 2
KCS401.4 2 2 1 2
KCS401.5 2 2 2 2
• Memory hierarchy
• Cache Organization
• Interrupt
• Registers
• Associative memory
•The disk arm starts at one end of the disk, and moves toward the
other end, servicing requests until it gets to the other end of the
disk, where the head movement is reversed and servicing
continues
•SSTF is common and has a natural appeal for low load disks
(quickly go to next request)
•LOOK, C-LOOK, SCAN and C-SCAN perform better for systems
that place a heavy load on the disk (no starvation, more
predictable delays)
•Performance depends on the number and
types of requests
•Requests for disk service can be influenced by the
file-allocation method
•Raw disk access for apps that want to do their own block
management, keep OS out of the way (databases for example)
•Boot block initializes system
•The bootstrap is stored in ROM
•Bootstrap loader program stored in boot blocks of boot
partition
•Methods such as sector sparing used to handle bad blocks
• Swap space can be carved out of the normal file system, or,
more commonly, it can be in a separate disk partition.
• 4.3BSD allocates swap space when process starts; holds text
segment (the program) and data segment.
• Kernel uses swap maps to track swap-space use.
• Solaris 2 allocates swap space only when a page is forced out of
physical memory, not when the virtual memory page is first
created.
– Lines
– Fixed length
– Variable length
• Complex Structures
– Formatted document
• Who decides:
– Operating system
– Program
15/05/2020 Dr C S Yadav KCS401 OS Unit Number:5 39
File Attributes(CO5)
• Time, date, and user identification – data for protection, security, and
usage monitoring
• Sequential Access
read next
write next
reset
skip forward
• Direct Access
read n
write n
position to n
read next
write next
rewrite n
n = relative block number
Directory
Files
F1 F2 F4
F3
Fn
• Each volume containing file system also tracks that file system’s info
in device directory or volume table of contents
• Create a file
• Delete a file
• List a directory
• Rename a file
Naming problem
Grouping problem
• Path name
• Can have the same file name for different user
• Efficient searching
• No grouping capability
• Grouping Capability
– cd /spell/mail/prog
– cd ~
– cd .
– cd ..
• Delete a file
rm <file-name>
mkdir <dir-name>
Deleting “mail” deleting the entire subtree rooted by “mail”
Example: if in current directory /mail
mkdir count
– Simple to program
– Time-consuming to execute
• Linear search time
• Could keep ordered alphabetically via linked list or use B+
tree
• Hash Table – linear list with hash data structure
• The directory contains a pointer to the first and last blocks of the
file
needs 1 ptr)
• Increases throughput (fewer head seeks).
traversed
block addresses
• Suffers from a wasted space due to the use of index block. (pointer
overhead is larger)
• How large the index block should be? What if a file is too large
for one index block?
• Linked scheme: use one block. To allow larger files, link
several index blocks
• Multilevel index: use a first-level index block to point to a
second-level index blocks
• Combined scheme: used in UNIX.
15/05/2020 Dr C S Yadav KCS401 OS Unit Number:5 75
Free-Space Management(CO5)
• File system maintains free-space list to track available
blocks/clusters
– (Using term “block” for simplicity)
• Bit vector or bit map (n blocks)
1 block[i] free
bit[i] = CPUs have instructions to
0 block[i] occupied return offset within
word of first “1” bit
– Modify linked list to store address of next n-1 free blocks in first
free block, plus a pointer to next block that contains free-block-
pointers (like this one)
• Counting
• Memory-mapped I/O
• Device data and command registers mapped to processor
address space
• Especially for large address spaces (graphics)
15/05/2020 Dr C S Yadav KCS401 OS Unit Number:5 83
Polling(CO5)
• For each byte of I/O
1. Read busy bit from status register until 0
2. Host sets read or write bit and if write copies data into data-out
register
3. Host sets command-ready bit
4. Controller sets busy bit, executes transfer
5. Controller clears busy bit, error bit, command-ready bit when
transfer done
• Step 1 is busy-wait cycle to wait for I/O from device
• Reasonable if device is fast
• But inefficient if device slow
• CPU switches to other tasks?
• But if miss a cycle data overwritten / lost
• Block I/O
• Network sockets
• https://www.youtube.com/watch?v=aKmuGwHj3Cw
• https://www.youtube.com/playlist?list=PLmXKhU9FNesSF
vj6gASuWmQd23Ul5omtD
• https://www.youtube.com/watch?v=Fizc0nXRm2g
• https://www.youtube.com/watch?v=RgYU5r9A5TU
• https://nptel.ac.in/courses/106108101
Weekly Assignment
• Explain Seek Time and Rotational Latency