21CSE47A
21CSE47A
1 Services
1. INTRODUCTION
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
USER VIEW
PREPARED BY
UNIT- Introduction to Operating System
1 Services
SYSTEM VIEW
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
ADVANTAGES OF MULTIPROGRAMMING
● Multiprogrammed systems provide an environment in which the
various system resources (for example, CPU , memory, and
peripheral devices) are utilized effectively, but they do
not provide for user interaction with the computer system.
MULTITASKING
● Time sharing (or multitasking) is a logical extension of
multiprogramming. In time-sharing systems, the CPU executes
multiple jobs by switching among them, but the switches occur
so frequently that the users can interact with each program
while it is running.
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
4. Operating-System Operations
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
IMPORTANCE OF TIMER
● We must ensure that the operating system maintains control
over the CPU .
● We cannot allow a user program to get stuck in an infinite
loop or to fail to call system services and never return
control to the operating system.
● To ensure that the control will be returned to kernel
mode ,we require the use of timers.
● A timer can be set to interrupt the computer after a
specified period. The period may be fixed (for example, 1/60
second) or variable (for example, from 1 millisecond to 1
second).
● A variable timer is generally implemented by a fixed-rate
clock and a counter.
IMPLEMENTATION
PREPARED BY
UNIT- Introduction to Operating System
1 Services
● The operating system sets the counter. Every time the clock
ticks, the counter is decremented. When the counter reaches
0, an interrupt occurs.
● Before turning over control to the user, the operating system
ensures that the timer is set to interrupt. If the timer
interrupts, control transfers automatically to the
operating system, which may treat the interrupt as a fatal
error or may give the program more time.
Operating-System Services
● An operating system provides an environment for the
execution of programs.It provides certain services to programs
and to the users of those programs.
PREPARED BY
UNIT- Introduction to Operating System
1 Services
● The services provided by the OS can be broadly classified
from two view points:USER AND SYSTEM
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
PREPARED BY
UNIT- Introduction to Operating System
1 Services
● These services exists not for helping the user but rather for
ensuring the efficient operation of the system itself.
PREPARED BY
UNIT- Introduction to Operating System
1 Services
account the speed of the CPU , the jobs that must be executed,
the number of registers available, and other factors.
● For the efficient use of I/O devices also routines exist to
allocate printers, USB storage drives, and other peripheral
devices.
PREPARED BY
UNIT- Introduction to Operating System
1 Services
SYSTEM CALLS
● System Calls provide an interface to the services made
available by an operating system. These calls are generally
available as routines written in C and C++, although certain low-
level tasks (for example, tasks where hardware must be accessed
directly) may have to be written using assembly-language
instructions.
● EG:To write a simple program to read data from one file
and copy them to another file.
● STEP 1:GET NAMES OF FILES-These names can be specified in
many ways, depending on the operating-system design. One approach
is for the program to ask the user for the names. In an
interactive system, this approach will require a sequence of
system calls, first to write a prompting message on the screen
and then to read from the keyboard the characters that define
the two files. On mouse-based and icon-based systems, a menu of
file names is usually displayed in a window.
● The user can then use the mouse to select the source name,
and a window can be opened for the destination name to be
specified. This sequence requires many I/O system calls.
PREPARED BY
UNI Introduction to Operating System
● STEP 2:open the input file and create the output file
. Each of these operations requires another system call.
Possible error conditions for each operation can require
additionalsystem calls.
● ERROR CONDITIONS: No input file ,NO access permission
for the input file,Output file already exists,
● In these cases, the program should print a message on
the console (another sequence of system calls) and
then terminate abnormally (another sequence of system
call).
● STEP3:When both files are set up, we enter a loop that reads
from the input file (a system call) and writes to the
output file (another system call).
● STEP 4:Each read and write must return status information
regarding various possible error conditions.
● POSSIBLE ERRORS: the end of the file ,a hardware
failure in the read (such as a parity error).The write
operation may encounter various errors, depending on the output device
STEP 5:Close both the files(system call),write success(system
call) or error prompt(system call)
PREPARED BY Ms.UMA.N,ASST.PROF,NHCE
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
● process control
● file manipulation
● device manipulation
● information maintenance,
PREPARED BY
UNI Introduction to Operating System
● communications
● protection.
Process Control
When a process is in execution various scenarios happen.
● For a program to be executed it has to be first loaded into
the main memory.This is done via load() system call.
● A running program needs to be able to halt its execution
either normally ( end() ) or abnormally ( abort() ).
● Under either normal or abnormal circumstances, the operating
system must transfer control to the invoking command
interpreter.
● In an interactive system, the command interpreter
simply continues with the next command assuming user
will issue appropriate command.
● In a GUI system, a pop-up window might alert the user
to the error and ask for guidance.
● In a batch system, the command interpreter usually
terminates the entire job and continues with the next
job.
● A process or job executing one program may want to load() and
execute() another program. Eg:keeping track of mouse clicks to
execute the necessary commands.
● If control returns to the existing program when the new
program terminates, we must save the memory image of the
existing program; thus, we have effectively created a
mechanism for one program to call another program. If both
PREPARED BY
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
● load, execute
● create process, terminate process
● get process attributes, set process attributes
● wait for time
● wait event, signal event
● allocate and free memory
File Management
● There are various system calls which comes under file
management.
● Ability to create or delete files via create() and delete()
files.
● Either system call requires the name of the file and
perhaps some of the file’s attributes.
● Once the file is created, we need to open() it and to use it.
We may also read() , write() , or reposition() (rewind or
skip to the end of the file, for example).
● Finally, we need to close() the file, indicating that we are
no longer using it.
● We may need these same sets of operations for directories if
we have a directory structure for organizing files in the
file system.
● Attributes are those properties that define a file.Eg:name,
file type, protection codes, accounting information, and
so onwith respect to attributes,the operating system should
be able to get file attributes()or In addition, for either
PREPARED BY
UNI Introduction to Operating System
● File management
● create file, delete file
● open, close
● read, write, reposition
● get file attributes, set file attributes
Device Management
● A process may need several resources to execute —main memory,
disk drives, access to files, and so on.
● If the resources are available, they can be granted, and
control can be returned to the user process.
● Otherwise, the process will have to wait until sufficient
resources are available.
● The devices controlled by the operating system can be
physical devices (for example, disk drives), or abstract
virtual devices (for example, files).
● A system with multiple users may require us to first
request() a device, to ensure exclusive use of it. After we
are finished with the device, we release() it.These functions
are similar to the open() and close() system calls for files.
PREPARED BY
UNI Introduction to Operating System
Information Maintenance
● For the purpose of transferring information between the
user program and the operating system there are many system
calls.For example, most systems have a system call to return
the current time() and date() .
● Other system calls may return information about the system,
such as the number of current users, the version number of
PREPARED BY
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
communication
PREPARED BY
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
PROTECTION
● Protection provides a mechanism for controlling access to the
resources provided by a computer system.
● Typically, system calls providing protection include set
permission() and get permission() , which manipulate the
permission settings of resources such as files and disks. The
allow user() and deny user() system calls specify whether
particular users can—or cannot—be allowed access to certain
resources.
SUMMARY ABOUT SYSTEM CALLS UNDER PROTECTION
● Set permission()
● Get permission()
● Deny permission()
● Allow user()
● Deny user()
PREPARED BY
UNI Introduction to Operating System
Operating-System Structure
Simple Structure
PREPARED BY
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
Layered Approach
● With proper hardware support, operating systems can
be broken into pieces that are smaller and more
appropriate .
● The operating system can then retain much greater
control over the computer and over the applications
that make use of that computer.
● Implementers have more freedom in changing the
inner workings of the system and in creating
modular operating systems by providing data
abstraction or information hiding.
● In a layered system , the operating system is broken
into a number of layers (levels).
● The bottom layer (layer 0) is the hardware;
● The highest (layer N) is the user interface.
PREPARED BY Ms.UMA.N,ASST.PROF,NHCE
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
PREPARED BY
UNI Introduction to Operating System
Microkernels
● Researchers at Carnegie Mellon University developed
an operating system called Mach that modularized
the kernel using the microkernel approach.
messages messages
user
mod
Interprocess Communication memory managment CPU e
scheduling
microkernel
hardware kerne
l
mode
PREPARED BY
UNI Introduction to Operating System
space.
● Communication is provided through message passing.
ADVANTAGES
● Extensions of the operating system is easier . All
new services are added to user space and consequently
do not require modification of the kernel.
● When the kernel have to be modified, the changes
tend to be fewer, because the microkernel is a
smaller kernel and it is easier to compile the
kernel.
● The resulting operating system is easier to port
from one hardware design to another.
● The microkernel also provides more security and
reliability, since most services are running as user
rather than kernel processes. If a service fails,
the rest of the operating system remains
untouched.
● Examples of operating systems which uses microkernel
approach :
● Tru64 UNIX (formerly Digital UNIX ) provides a
PREPARED BY
UNI Introduction to Operating System
DISADVANTAGES
Modular Approach
● This is the best current methodology adopted in
various operating-system design. This type of
design is common in modern implementations of UNIX
, such as Solaris, Linux, and Mac OS X , as well
as Windows.
● It involves designing kernel modules as loadable
kernel modules. Here, the kernel has a set of
core components and links in additional services
PREPARED BY
UNI Introduction to Operating System
PREPARED BY Ms.UMA.N,ASST.PROF,NHCE
UNI Introduction to Operating System
1. Scheduling classes
2. File systems
3. Loadable system calls
4. Executable formats
5. STREAMS modules
6. Miscellaneous
7. Device and bus drivers
Hybrid Systems
Mac OS X
● The Apple Mac OS X operating system uses a
hybrid structure.
PREPARED BY
UNI Introduction to Operating System
BSD
PREPARED BY
UNI Introduction to Operating System
● It is a layered system.
● The top layers include the Aqua user interface
and a set of application environments and
services.
● The Cocoa environment specifies an API for the
Objective-C programming language, which is used
for writing Mac OS X applications.
● Below these layers is the kernel environment,
which consists primarily of the Mach
microkernel and the BSD UNIX kernel.
● Mach provides memory management;support for
remote procedure calls ( RPC s) and
interprocess communication( IPC ) facilities,
including message passing; and thread
scheduling.
● The BSD component provides a BSD command-line
interface, support for networking and file
PREPARED BY
UNI Introduction to Operating System
Aqua GUI
Cocoa API For Objective C Programming Language
Mach Memory management,RPC,IPC,message
passing,thread scheduling
BSD CLI,Support for network and file
systems,POSIX APIs,
I/O Kit Device Drivers
iOS
● iOS is a mobile operating system designed by
Apple to run its smartphone, the iPhone, as well
as its tablet computer, the iPad.
● iOS is structured on the Mac OS X operating
system, with added functionality pertinent to
mobile devices,
● It does not directly run Mac OS X applications.
The structure of i OS is as shown below
PREPARED BY
UNI Introduction to Operating System
Android
PREPARED BY
UNI Introduction to Operating System
Applications
Application Framework
PREPARED BY
UNIT-1 Introduction to Operating System Services
END OF UNIT -1
PREPARED BY Ms.UMA.N,Sr.ASST.PROF,NHCE
MODULE 2
PROCESS
What it is ???
•Program in execution state
How it executes …
- Using resources CPU, Memory, I/O devices
When Resources are allocated…
-Process creation time, Execution time
• System has many processes
• How process executes
- Sequentially or Parallely
- “””Thread”””” concept
• How many Thread a process can have??
• OS responsible for ‘’’’P ‘’R management….
• Process scheduling..
• Communication…
PROCESS…
• How many Thread a process can have??
- Single threaded , Multithreaded
As a process executes, it changes state. The state of a process is defined in part by the current activity of that
process.
A process may be in one of the following states:
• NEW
• RUNNING
• WAITING
• READY
• TERMINATED
• Each process is represented in the operating system by a process control block (PCB)
• TCB
The state may be new, ready, running, waiting, halted, and so on.
2. Program counter.
3. CPU registers.
4. CPU-scheduling information.
-Process priority
5. Memory-management information.
- page table
- segment table
- register values
6. Accounting information.
PCB..
P
Th3
Th1 Th2
PROCESS SCHEDULING
- Multiprogramming
- Process Scheduler
Current
P1
CPU
Waiting Switches
P2
Pn
PCB..
P
Th3
Th1 Th2
Scheduling queues:
Job queue, Ready queue
PCB pointers
I/O request
Device queue
3 events occurs
• Two types of queues are present: the ready queue and a set of device queues.
- new process is initially put in the ready queue. It waits there until it is selected for execution, or dispatched.
- Once the process is allocated the CPU and is executing, one of several events could occur:
- .
•1. The process could issue an I/O request and then be placed in an I/O queue.
• 2.The process could create a new child process and wait for the child’s termination.
•3. The process could be removed forcibly from the CPU, as a result of an interrupt, and be put back in the
ready queue.
In the first two cases, the process eventually switches from the waiting state to the ready state and is then put
back in the ready queue.
More frequent
Less frequent
Control Multiprogramming
• I/O bound process
The key idea behind a medium-term scheduler is that sometimes it can be advantageous to remove a process
from memory (and from active contention for the CPU) and thus reduce the degree of multiprogramming.
Later, the process can be reintroduced into memory, and its execution can be continued where it left off.
The process is swapped out, and is later swapped in, by the medium-term scheduler.
Swapping may be necessary to improve the process mix or because a change in memory requirements has
overcommitted available memory, requiring memory to be freed up.
CONTEXT SWITCH
• state save
• rescheduled to run.
- Switching speed varies from machine to machine, depending on the memory speed, the number of registers
• Creation
• Deletion
• execution
• Kill ----Normal------Abnormal
• Pid
•Init : The init process (which always has a pid of 1) serves as the root parent process for all user processes.
“we can obtain a listing of processes by using the ps command. For example, the command
ps –el
When a process creates a new process, two possibilities for execution exist:
1. Pp parallel with Cp
2. Pp waits for Cp
There are also two address-space possibilities for the new process:
1. Cp is copy of Pp
-”Cascading Termination”
TerminateProcess() in Windows
return Pid of Cp
• The wait() system call is passed a parameter
• This system call also returns the process identifier of the terminated child so that the parent can tell
which of its children has terminated:
init() in Linux
pid is 1
create various user P
Eg: web server, print server , ssh server
- Independent Process
P1
- Cooperative Process
P2
P3
Pn
Why IPC ????
-Information Sharing
-Computation Speed up
-Modularity
- Convenience
SHARED MEMORY MODEL
Message pass model
P1
n/w P2
S1
S2
send(msg) receive(msg)
indirect mode
• use mail box
• it is data structure
M
p AI
L p
BO
X
• BUFFERS
• ZERO CAPACITY
• BOUNDED CAPACITY
• UN BOUNDED CAPACITY
CPU SCHEDULING::
Cpu scheduler
Ready queue
P4 P3 P2 P1
Cpu scheduler C
P
U
LTS
P1 P2 P3 P4
DISK / SECONDARY P5
STORAGE High Priority Task
P4 P3 P2 P1
P1
STS
Cpu scheduler C
P
U
LTS
SWAP OUT
P1
DISK / SECONDARY P5
STORAGE High Priority Task
P4 P3 P2 P5 Terminates
P5
STS
Cpu scheduler C
P
U
LTS
SWAP OUT
P1
DISK / SECONDARY P5
STORAGE High Priority Task
P4 P3 P2 P1 Terminates
P1
STS
Cpu scheduler C
P
U
LTS
P1
DISK / SECONDARY
STORAGE
1. CPU UTILIZATION
2. THROUGHPUT
4. WAITING TIME
5. RESPONSE TIME
PREEMPTIVE & NON – PREEMPTIVE SCHEDULING
NON-PREEMPTIVE
EG: FCFS
PREEMPTIVE SCHEDULING
P3
EG:: SJF
ROUND ROBIN
PRIOTIRY
• FCFS TECHNIQUE:::
GANTT CHART….
process arriving in the order P1, P2, P3….
AT(P3)
AT(P2)
WT(p2) ==24
WT(p3)==27
EXAMPLE-2
wt(p1) =0
wt(p2)=6
wt(p3)=14
wt(p4)=21
AWT=10.25 msecc
p1 p3 p4
p2
0 6 14 21 24
• SHORTEST JOB FIRST SCHEDULING (SJF)
Process with Minimum CPU time / Burst Time is allocated to CPU
P3
P4 P1 P2
0 2 5 11 19
Above diagram is called as GANTT CHART
• P4 =WT(P4)=2msec
• P1 =WT(P1)=5msec
• P2 =WT(P2)=11msec
== (p1+p2+p3+p4)/4
== (5+11+0+2) / 4
== 18 /4
==4.5 msec
SJF(shortest job firs) Example -2
p4 p3 p1 p2
0 1 3 9 17
AWT== WT(P4+P3+P1+P2)/4
== 0+1+3+9 / 4
== 3.25 msecc
SJF SCHEDULING
• Shortest Remaining time First Schedule Algorithm (SRTF)
• Process P1 is started at time 0, since it is the only process in the queue.
• The remaining time for process P1 (7 milliseconds) is larger than the time required by
process P2 (4 milliseconds)
• process P1 is preempted, and process P2 is scheduled.
Priority….???
“”Aging “”
6 16 20 28
0
AWT== WT(P4+P3+P1+P2)/4
== 0+6+16+20/ 4
== 10.5 msec
• ROUND ROBIN SCHEDULING (RRS)
• Pre-emption of process
• 10-100 msec
Open-File Table
- Contains information about all open
files
• When a file operation is requested, the file is specified via an
index into this table, so no searching is required
• When a file is no longer being actively used, it is closed by the
process and the OS removes its entry from the open-file table
• Create and delete are system calls that work with closed rather
than with open files
Open(), Close()
• Types of access
– Read
– Write
– Execute
– Append
– Delete
– List
ACCESS LIST AND GROUPS
ACCESS CONTROL
• Scheme Implemented
• Identity dependent access is associated with each file and
directory called as Access-Control List (ACL)
• Mode of Access
– read, write, execute
• Three classes of users
RWX
a) owner access (creator) 7 111
RWX
b) group access (Shared user) 6 110
RWX
c) public access (all other users) 1 001
Windows XP Access-control List Management
A Sample UNIX Directory Listing
Partition and mounting
• In-memory information
– Used for both file-system management and performance improvement
via caching
– Data are loaded at mount time, updated during file-system operations
and discarded at dismount
• Types of Structures used
– In-Memory Mount Table
• Contains information about each mounted volume
– In-Memory Directory-Structure
• Cache, holds the directory information of recently accessed directories
– System-wide Open-File Table
• Contains a copy of the FCB of each open file, as well as other information
– Per-Process Open-File Table
• Contains a pointer to the appropriate entry in the system-wide open-file table
– Buffers
• Hold file-system blocks when they are being read from disk or written to disk
A Typical File Control Block (FCB)
Linked Allocation
Indexed Allocation
CONTIGUOUS ALLOCATION
• Each file occupies a set of contiguous blocks
on the disk
• Example:
File is n blocks long and starts at location b,
then, it occupies block
b, b+1, b+2, … , b+n-1
• Directory entry consists of addresses of :
– Starting block
– Length
• Strategy used to find the free hole:
– First Fit
– Best Fit
• Advantage:
– Simple – only starting location (block #) Disk
and length (number of blocks) are
required
Used in CDROMs, DVDs
• Disadvantage:
– Wasteful of space (dynamic storage-allocation problem)
– Suffers from external fragmentation
• Files allocated and deleted, the free disk space is
broken into little pieces
• Solution:
– Compaction Technique, but expensive
– Complex to determine how much space is needed for a
file
• When creating a file, total amount needed for a file must
be found and allocated
• Allocating too little space : File cannot grow
• Allocating too large space: Space wasted
LINKED ALLOCATION
block = pointer
• Create a new file
– Create a new entry in the directory, with 2 pointers, 1 to first block,
initialize it to nil
– File is initially empty
• Read a file
– Simply follow the file pointer from block to block
• Write to a file
– Find a free block, written to and linked to the end of the file
• Pros
– No space lost to external fragmentation
– Disk only needs to maintain first block of each file
– Size of the file need not to be declared
• Cons
– Random access is costly
– Overheads of pointers. Ex. Size of a block is 512 bytes, and if pointer
occupies 4 bytes, then user sees block of 508 bytes only
– Loss/damage of file pointer, leads to incorrect access
MS-DOS FILE SYSTEM
• Implement a linked list allocation using a table
– Called File Allocation Table (FAT)
– Take pointer away from blocks, store in this table
-1 special value in the table denotes, end-of-file
0 indicates unused blocks
File-Allocation Table
INDEXED ALLOCATION
• Solves external
fragmentation and
size declaration
problem
• Brings all pointers
together into the
index block.
• Logical view.
Indexed table
• Creating a new file
– Set pointer in the index block to nil
– When ith block is written, a block is obtained from the free-space
manager, and its address is put in the ith index-block entry
• Every file will have an index block, so it must me as small as possible
• If index block is too small, it can’t handle enough pointers
• Mechanisms used for solving this purpose: small file large file
pblm
– Linked Scheme
• For a large file, link several index blocks together.
– Multilevel Index
• First level index block can point to the set of second level index
blocks, which in turn point to the file block
– Combined Scheme
• Direct Blocks
– Contains addresses of the blocks that contain data of a file
– Can be used for small files
• Indirect Blocks
– First points to a single indirect block, contains an index block (contains no
data), but the addresses of the block that contains data
– Double indirect block – Contains address of the block containing actual data
– Triple indirect block – Last pointer, containing address of the triple indirect
block
Combined Scheme: UNIX (4K bytes per block)
Direct blocks:
15 pointers of index blocks
FREE SPACE MANAGEMENT
QUESTIONS
• December 2013/Jan 2014
How is free space managed? Explain. (5 Marks)
• June/July 2013
Explain the different approaches to managing free space on disk storage.
(10 Marks)
• June/July 2014
What do you mean by free space list? With suitable example, explain any
two methods of implementation of free space list. (8 Marks)
• June/July 2015
Explain bit vector free-space management technique. (05 Marks)
• December 2015
Write a note on any four different methods for managing free space. (6
Marks)
• Need for Free-Space Management
– Disk space is limited, we need to reuse the space from deleted
files for new files, if possible
• Free-Space List
– Used to keep track of free disk space, system maintains free-
space list
• Free-Disk Blocks
– Free-space list records all free disk blocks – those that are not
allocated to some file or directory
• On Creating a File
– Search the free-space list for the required amount of space and
allocate that space to the new file
– This space is then removed from the free-space list
• On Deleting a File
– The disk-space is added to the free-space list
• Free-Space Management Approaches
– Bit Map or Bit Vector
– Linked List
– Grouping
– Counting
• Bit Map or Bit Vector
– Each block is represented by 1 bit
1 block[i] free
… bit[i] =
0 block[i] occupied
• Example
• Consider a disk where blocks 2,3,4,5,8,9,10,11,12,13,17,18,25,26 and
27 are free and rest of the blocks are allocated
• Free-space bit map would be
001111001111110001100000011100000…
• Technique for finding the first free block
– Check the disk space sequentially for checking whether the
value is not 0
– The first non-0 word is scanned for the first 1 bit
• Advantage of this approach
– Simple
– Efficient in finding contiguous free blocks on disk
• Disadvantage
– Requires extra space
• Linked List free-space on disk
– Link all the free disk blocks
– Keep the pointer to the first free
block in a special location of the
disk
• Example
Consider a disk where blocks
2,3,4,5,8,9,10,11,12,13,17,18,
25,26 and 27 are free and rest
of the blocks are allocated
-Block 2 points to block 3, block 3 points
to block 4, so on…
• Advantage
– No waste of space
• Disadvantage
– Scheme is not efficient
– As it needs to traverse and read each block, which
takes too much of I/O time
– Cant get contiguous space easily
• Grouping
– Stores the addresses of n free blocks in the first free
blocks
– The first n-1 of these blocks are actually free
– The last block contains the addresses of another n free
blocks and so on
Advantage
Address of large
number of free blocks
can be found easily
• Counting
– Several contiguous blocks may be allocated or
freed simultaneously
– Keep the list of n free disk addresses in the first
free block and the number (n) of free contiguous
blocks that follow the first block
– Each entry in the disk space consists of a disk
address and count