2. FUNCTIONS OF OS
Process management
Memory management
File management
Device management
Security management
User interface
3. FILE MANAGEMENT
Provides a hierarchical structure for
the entire data.
Provides a set of commands to
perform various operations on the
file.
The file manager
Controls access to files.
Supervises the creation, deletion, and
modification of files.
Controls the naming of files.
Supervises the storage of files.
Responsible for archiving and
backups.
4. USER INTERFACE
Provides 2 types of user interface
CLI
Provides an interactive terminal.
User can communicate with the
system through the terminal.
Commands are used to initiate a
program.
GUI
Provides users with pictures,
icons, buttons and dialog boxes.
User sends instructions by moving
a pointer on the screen.
5. SECURITY MANAGEMENT
Provides internal security to the
system .
Can be provided by using
User Authentication
Back up of data
6. DEVICE MANAGEMENT
Managing the various devices
connected to the system.
OS communicates with the
hardware by using the
software called device driver.
Spooling
Refers to storing jobs in a
buffer, where a device can
access them when it is
ready.
Provides a waiting station
for devices.
Eg: Print spooling.
7. PROCESS MANAGEMENT
Manages all processes that are running on a
computer.
It is responsible for
Process creation and deletion.
Process suspension and resumption.
Process scheduling
Resource allocation
8. PROCESS STATE
New
The process is being created.
Ready
The process is waiting to be assigned
to a process.
Running
Instructions are being executed.
Waiting
The process is waiting for some
event to occur.
Terminated
The process has finished execution.
9. PROCESS CONTROL BLOCK (PCB)
A data structure maintained by
the OS for each process
It contains
Process ID
Process state
Program counter
CPU scheduling information
I/O status information
10. CPU SCHEDULING
Process of allocating CPU time among all processes.
Scheduling can be performed with the help of
schedulers.
For scheduling purposes, different queues are used.
Job queue
Set of all jobs in the system.
Ready queue
Set of all processes waiting for the CPU.
Device queue
Set of processes waiting for an I/O device.
12. CPU SCHEDULERS
Long-term scheduler (job scheduler)
Selects job from the job queue and loads it into the main
memory for execution.
Short-term scheduler (CPU scheduler)
Selects a process from the ready queue and allocates CPU to
it.
Medium term scheduler
Decides whether to introduce a process from running state
to a waiting state or a waiting state to the ready state.
13. CPU SCHEDULING
CPU scheduling decisions may take place when a
process:
1. Switches from running to waiting state
2. Switches from running to ready state
3. Switches from waiting to ready
4. Terminates
Conditions 1 & 4 comes under non-preemptive
scheduling.
All other conditions come under preemptive
scheduling.
14. CPU SCHEDULING
Non-preemptive scheduling
Once the CPU has been allocated to a process, the
process keep the CPU until it release the CPU either by
terminating or by switching to waiting state.
Preemptive scheduling
Scheduler can remove a process from the running state
to the other state in order to allow other processes to
run.
15. PROCEDURES FOR CPU SCHEDULING
First Come First Served (FCFS)
Round Robin Scheduling
16. First Come First Served (FCFS)
All processes are enter in a queue.
New process arrived is placed at the end of the queue.
Process at the start of the queue is dispatched to the
processor.
Falls under non-preemptive scheduling.
If a process takes a very long time to complete, then other
processes have to wait .
17. Round Robin Scheduling
Processes are allocated CPU time on a turn basis.
Each process is allocated a fixed time to use the CPU.
The time is known as time slice or quantum period.
Falls under preemptive scheduling.
19. DEADLOCK
A set of blocked processes each
holding a resource and waiting to
acquire a resource held by another
process in the set.
20. DEADLOCK
Various conditions are
o Mutual exclusion
Only one process at a time can use a resource.
Hold and wait
A process holding at least one resource is waiting to acquire
additional resources held by other processes.
No preemption
A resource can be released only after that process has
completed its task.
Circular wait
There must be a circular chain of 2 or more processes where
each is waiting for a resource held by the next member of the
chain.
21. MEMORY MANAGEMENT
The part of the OS that performs memory management is
known as Memory Manager.
Memory Manager is responsible
Keeping track of which parts of memory are currently
being used and by whom.
Decide which processes are to be loaded into memory
when memory space becomes available.
Allocate and de-allocate memory space as needed
22. MEMORY MANAGER
The main task of Memory Manager is
Memory Relocation
Memory Protection and Sharing
23. MEMORY RELOCATION
Swapping
Moving a process temporarily out of memory to a backing
store and then brought back to memory for continued
execution.
24. MEMORY ALLOCATION
OS allocates a portion of the primary memory to each
process for its own use.
Methods used for memory allocation
First Fit
Allocate the first hole that is big enough.
Best Fit
Allocate the smallest hole that is big enough.
Worse Fit
Allocate the largest hole.
26. PAGING
A memory management scheme that allows processes
to be stored non-contiguously in memory.
Physical memory is divided into fixed sized blocks
called page frames.
Logical memory is divided into fixed sized blocks
called pages.
When a program is loaded into memory, each page is
loaded into a page frame and the frame can be residing
anywhere in the memory.
OS maintains a page table for keeping track of the
pages of the process.
27. PAGING
Logical address is divided into 2 parts
Page number (p)
Page Offset (d)
To map the logical address to physical address in memory a
mapping table called page table is used.
To map a given logical address to a physical address, Os
first extracts the page no and offset.
If the page no is valid, the system uses page no to find the
corresponding page frame no in the page table.
The page frame no is attached to the page offset to form
the physical address in memory
29. VIRTUAL MEMORY
A memory larger than the physical memory placed on
the hard disk.
Data is stored on the VM and can be loaded into main
memory whenever needed.
The process of swapping pages from VM to main
memory is known as page –in or swap-in.
In VM systems, the page table of each process stores
an additional bit to identify the location of the page.
If the bit is 1, the page is in the main memory
otherwise in the virtual memory.
30. VIRTUAL MEMORY
Wherever a page reference is made, the Os checks the
page table for that page.
If the page is not in the main memory, a page fault
occurs and control is passed to the page fault routine
in the Os.
Page fault routine checks whether the virtual address
of that page is valid or not.
If it is valid, locates the free frame in the memory and
allocate the process.
If it is not valid, it terminates the process.