0% found this document useful (0 votes)
30 views30 pages

Unit 5 - OS

OPERATING SYSTEM NOTES UNIT - 5 AKTU (2023-24)

Uploaded by

waxaw90937
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views30 pages

Unit 5 - OS

OPERATING SYSTEM NOTES UNIT - 5 AKTU (2023-24)

Uploaded by

waxaw90937
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

RAJ KUMAR GOEL INSTITUTE OF TECHNOLOGY ,

Ghaziabad
Operating Systems
BCS-401

Unit: V

Operating System

Mr. H.S.Tomer
B Tech :4th Sem Assistant Professor
CSE(AI&ML)
1
Course Outcomes

Course outcome: After completion of this course students will be able to:

CO1 Understand the structure and functions of OS K1, K2

CO2 Understand the principles of concurrency and Deadlocks K2

CO3 Learn about Processes, Threads and Scheduling algorithms K1, K2

CO4 Learn various memory management scheme K2

CO5 Study I/O management and File systems. K2,K4


2
Course Outcome of Unit 5

After completion of this Unit students will be able to:-

• CO5: Study I/O management and File systems.

3
Memory Management

Disk storage (also sometimes


called drive storage) is
a general category of storage
mechanisms where data is
recorded by various
electronic, magnetic, optical,
or mechanical changes to a
surface layer of one or more
rotating disks.
A disk drive is a device
implementing such a storage
mechanism.

4
Memory Management

Disk storage (also sometimes


called drive storage) is
a general category of storage
mechanisms where data is
recorded by various
electronic, magnetic, optical,
or mechanical changes to a
surface layer of one or more
rotating disks.
A disk drive is a device
implementing such a storage
mechanism.

5
Memory Management

6
Memory Management
• Seek Time: Time to position heads on cylinder (a fixed head disk does not
require seek time but is more expensive than a moving-head disk)
• Rotational Latency: Delay in accessing material once seek accomplished
(time required to wait for data to rotate around under head)
• Transmission time: Time to transfer information once it is under the head.
• Access Time = seek time + rotational latency + read/write transmission time

7
Memory Management
Disk Scheduling: - In Multiprogramming, there are many processes that may be running
simultaneously and may request I/O operation from/to the dark disk. Among the various
request we need to schedule the order of request this is called Disk Scheduling. The main
objective of disk scheduling are-
•Minimize the response time i.e. the average time that a request must wait before it is
satisfied.
•Maximize the throughput i.e. the average No. of request satisfied be unit of time.

The various disk scheduling Algo are: -

8
Memory Management
First-In-First-Out (FIFO): - It processes the I/O request in the same order as they arrive.
Advantage – Improve response time.
Disadvantage – Low throughput.

9
Memory Management
•Shortest Seek Time First (SSTF): - It selects the request that needs to access a track
/sector, which is closer to the current location of the head
Advantage – Throughput better than FIFO.
Disadvantage – Some process may have to wait for long time.

10
Memory Management
•Scan: - In this the head always contently moves from the most inner cylinder to the outer
cylinder, then it changes its direction back towards the center. As the head moves, if there
is a request for the current disk position, it is satisfied.
Advantage –Throughput better than FIFO

11
Memory Management
•Circular Scan (C – Scan): - It is advancement of SCAN algorithm in which requests are
satisfied only when the head moves in one direction (i.e. forward)

12
Memory Management
•Look: - It is similar to SCAN, in this the direction of head changes if there are no requests
beyond the current point.
Advantage – Improve throughput and response time.

13
Memory Management
•Circular Look (C – Look): - It is similar to C-SCAN, with head turns it direction if there
are no request beyond the current point.

14
Memory Management

•Suppose the head of a moving head disk with 200 tracks numbered from 0 to 199 is
currently serving a request for track 143 and has just finished a request for track 125. The
queue of pending requests, in FIFO order is: 86, 147, 91, 177, 94, 150. Starting from the
current head position, what is the total distance that the disk arm moves to satisfy all pending
results for each of the following disk scheduling algorithm?

•First-In-First-Out (FIFO)
•Shortest Seek Time First (SSTF)
•Scan
•Circular Scan (C – Scan)
•Look
•Circular Look (C – Look)

15
Memory Management

File: - A file is a collection of related information defined by its creator.


Or
A file is the smallest allotment of secondary storage devices i.e. disk. Logically a file
is a sequence of logical records or we can say a sequence of bits and bytes.
• A file represents program and data.
• A file has attributes the Name, Type, Location, Size etc.

16
Memory Management

File Types: - Different type of information may be stored in a file the source program, object
program, numeric data etc.
The file name is split into two parts
•A Name File Type Usual Extension Function
•An Extension Executable Exe, com, bin or none Read to run machine language program
Object obj, O Compiled, machine language not linked
Source Code C, CC, Java, Pas, asm, Source code in various languages
Batch a Commands to the command interpreter
Text Bat, sh Textual data, documents
Word Processor txt, doc Various word-processor formats
Library up, tex, rrf, doc Libraries of routines for programmers
Print or lib, a, so, dill mpeg, ASCII or binary file in a format for printing or viewing
Preview mov, rm. Related files grouped into one file, sometimes
Archive arc, zip, tar compressed for archiving or storage
Multimedia avic, zip, tar Binary file containing audio or A/V information
17
mpegav, move, rm
Memory Management
File Operations: - The various operations performed on a file are-
•Create a file
•Writing a file
•Reading a file
•Repositioning a file
•Deleting a file
•Truncating a File

•Creating a File
To create a file, two steps are necessary:
1. Space in the file system must be found for the file. We discuss this in more detail in later
section.
2. An entry for the new file must be made in the directory. The directory entry records the
name of the file and the location in the file system, and some other information.
18
Memory Management
Writing a File
To write a file, we make a system call specifying both the name of the file and the information
to be written to the file. For the given file name, system searches the directory to find the
location of file. The system must keep a write pointer to the location in file where the next write
is to take place. The write pointer must be updated whenever a write occurs.
Reading a File
To read from a file, a system call specifies the file name and when the next block of the file
should be put in the memory. Again, the directory is searched for the associated where the next
read is to take place.
Once the read has taken place, the read pointer is updated. A given process is usually only
reading or writing a given file and the current operation location is kept as a current-file-
position-pointer per process. Both read/write operations use this pointer to save space in
memory and reduce the system complexity.

19
Memory Management
•Repositioning a File
Repositioning does not involve any actual I/O operation. This operation is also known as a file
seeks.
•Deleting a File
To delete a file, we search the directory for the named file. Having formed the associated
directory entry, we release all file space and invalidate the directory entry.
•Truncating a File
The user may want to erase the contents of a file but keep its attributes. This field allows all
attributes to remain unchanged except file length, rather than forcing user to delete the file.

20
Memory Management
Attributes of a File: - The various attributes of a file are-
• Name: The symbolic file name is the only information that is kept in human readable form.
• Identifier: This is a unique tag that is represented by a number which identifies the file within
the file system. It is in the form of non-human readable for the file.
• Type :This is the information about the file which is required for the system having different
types of files (Sec. 10.1).
• Location: This information is a pointer to a device and to the location if the file on that
device.
• Size: The current size of file (in bytes, words or block), and possibly the maximum allowed
size are included in this attribute.
• Protection: Access control information determines who can perform various operations
(section 10.3) on files.
• Time, data and User Identification: This information may be kept for creation, last
modification and last usage. These data can be useful for the protection and security.

21
Memory Management
File Organization and Access Mechanism: -
To use a file it is very important to organize the file in a proper manner so that the
access can be done easily. The various common file organization schemes are-
•Sequential Access
•Direct Access
•Index Access
• Sequential Access: - It is the simplest accessed method in which information stalled in file
is accessed in an order such that one record is processed after the other.
•Direct Access: - This method of access is based on disk model of a file [disk allow random
access] i.e. in disk a file is viewed as a numbered sequence of blocks or records which are
read/written in an arbitrary manner i.e. no restriction on the order of reading or writing.
•Indexed Access: - In this an index is created which contains a key field and pointers to the
various blocks.
To find an entry in the file for a key value, we 1st search the index and then use the pointer to
directly access a file and find the desired entry.
22
Memory Management
File Allocation Methods: - File allocation means how to allocate space to these file so that disk
space is utilizes in an effective manner and quickly files can be accessed. The various file
allocation methods are:-
•Contiguous allocation
•Linked allocation
•Indexed allocation
Contiguous Allocation: - This method requires each file to occupy a set of contiguous
addresses on disk.
Advantage: - Accessing a file is easy.
Disadvantage: - External fragmentation.
Time involved in finding space for a new file.

23
Memory Management

24
Memory Management
Linked Allocation: - In this allocation each file is a linked list of disk blocks which may be
scuttled at any place on the disk.
Advantage: - No external fragmentation.
No need to declare the size of a file when it is created.
A file can continue to grow as long as there are file blocks.
Disadvantage: - Sequential access to file (time consuming).
Reliability – as files are linked together by pointers scattered all over the disk.

25
Memory Management

26
Memory Management
Indexed Allocation: - In this all pointers are brought together into one location called index
block. Each file has its own index block which is an away of disk block address.ith entry in disk
block points to ith block of the file.

Advantage: - Allows direct access without external Fragmentation


Size of index block is normally one disk block for large files several index files
may be linked together.

27
Memory Management

28
Memory Management
Free Space Management: - As there is limited space on disk, we need to reuse the space from
deleted files for new files. To help trash of file disk space, the system maintains a file space list.
It records all file disk blocks.
To create a file we search the file space list for the required amount of space
and allocate that space to the new file. This space is then removed from the file space list when
a file is deleted; its disk space is added to the file space list.
File space list cab be implemented by following ways:-
•As a bit map: - If a block is allocated, the bit is 0 if it is file, the bit is 1.
Relatively simple
• Link together all the file disk blocks: - Keep a pointer to the first file block in a partial
location on the disk. This block contains a pointer to the next file disk block and so on.
Time consuming – as list is traversed.
• Store the addresses of n file blocks in 1st file block.

29
Faculty Video Links, Youtube & NPTEL Video Links and Online
Courses Details

Youtube/other Video Links

• https://www.youtube.com/watch?v=aKmuGwHj3Cw
• https://www.youtube.com/playlist?list=PLmXKhU9FNesSFvj6gASuWmQd23Ul5omtD
• https://www.youtube.com/watch?v=Fizc0nXRm2g
• https://www.youtube.com/watch?v=RgYU5r9A5TU
• https://nptel.ac.in/courses/106108101

You might also like