Final Unit 4 Spos 2023
Final Unit 4 Spos 2023
Prepared By
Prof. Anand N. Gharu
(Assistant Professor)
PVGCOE Computer Dept.
• I/O operations
• Communication
• Error Detection
• Resource Allocation
• Protection
Prof. Gharu Anand N. 6
• Program execution
• Operating systems handle many kinds of activities from user programs to
system programs like printer spooler, name servers, file server, etc. Each
of these activities is encapsulated as a process.
• A process includes the complete execution context (code to execute, data
to manipulate, registers, OS resources in use). Following are the major
activities of an operating system with respect to program management −
• Loads a program into memory.
• Executes the program.
• Handles program's execution.
• Provides a mechanism for process synchronization.
• Provides a mechanism for process communication.
• Provides a mechanism for deadlock handling.
Prof. Gharu Anand N. 7
• I/O Operation
• An I/O subsystem comprises of I/O devices and their
corresponding driver software. Drivers hide the peculiarities
of specific hardware devices from the users.
• An Operating System manages the communication between
user and device drivers.
• I/O operation means read or write operation with any file or
any specific I/O device.
• Operating system provides the access to the required I/O
device when required.
Prof. Gharu Anand N. 8
• File system manipulation
• A file represents a collection of related information. Computers can
store files on the disk (secondary storage), for long-term storage
purpose. Examples of storage media include magnetic tape, magnetic
disk and optical disk drives like CD, DVD. Each of these media has its
own properties like speed, capacity, data transfer rate and data access
methods.
• Following are the major activities of an operating system with respect
to file management −
• Program needs to read a file or write a file.
• The operating system gives the permission to the program for
operation on file.
• Permission varies from read-only, read-write, denied and so on.
• Operating System provides an interface to the user to create/delete
files.
• Operating System provides an interface to the user to create/delete
directories.
• Operating
Prof. Gharu Anand N.
System provides an interface to create the backup of file 9
• Communication
• In case of distributed systems which are a collection of processors that
do not share memory, peripheral devices, or a clock, the operating
system manages communications between all the processes. Multiple
processes communicate with one another through communication lines
in the network.
• CPU scheduling
Prof. Gharu Anand N. algorithms are used for better utilization of CPU. 11
• Protection
• Considering a computer system having multiple users and concurrent
execution of multiple processes, the various processes must be
protected from each other's activities.
• The OS ensures that external I/O devices are protected from invalid
access attempts.
- Main memory provides a fast storage that can be accessed directly by the CPU. For
a program to be executed, it must in the main memory. An Operating System does
the following activities for memory management −
- Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part
are not in use.
- In multiprogramming, the OS decides which process will get memory when and
how much.
- De-allocates processor
Prof. Gharu Anand N.
when a process is no longer required. 16
Device management
An Operating System manages device communication via their
respective drivers.
- Decides which process gets the device when and for how much
time.
- De-allocates
Prof. Gharu Anand devices.
N. 17
File management
A file system is normally organized into directories for easy
navigation and usage. These directories may contain files and other
directions.
CPU is often idle, because the speed of the mechanical I/O devices
is slower than the CPU.
Difficult toAnand
Prof. Gharu provide
N. the desired priority. 23
Multitasking
This set of jobs is a subset of the jobs kept in the job pool.
The operating system picks and begins to execute one of the jobs in the
memory.
Handles I/O device data spooling as devices have different data access rates.
Maintains the spooling buffer which provides a waiting station where data
can rest while the slower device catches up.
MANAGEMENT
CONCEPTS
Prof. Gharu Anand N. 34
Process
2. Ready − The processes that are loaded on RAM and waiting for CPU are in ready
state.
3. Running − The processes that are running on the CPU are in running state.
If the process is running in its critical section, then other processes need to wait in the
ready state.
4. Blocked − All processes that are leaving the CPU and moving to the waiting state
are in the blocked state. When the CPU becomes free, processes from the blocked state
again move to the ready state, and from ready to Running state.
5. Exit / Terminated − A process that is terminated from CPU and RAM is in the
terminate state.. 38
Seven State Process
2. Ready − Contains the processes that are present in main memory and available for
execution.
5. Blocked − Contains the processes that are present in main memory and awaiting an
event to occur.
7. Ready Suspend − Contains the processes that are present in secondary memory but
is available for execution as soon as it is loaded into main memory.
40
Process Control Block
Process ID, and parent process ID.: This shows the number of the
particular process
Registers -
This specifies the registers that are used by the process. They may
include accumulators, index registers, stack pointers, general purpose
registers etc.
Prof. Gharu Anand N. 42
Process Control Block
List of Open Files :
These are the different files that are associated with the process
This information includes the list of I/O devices used by the process,
the list of files etc
Accounting information :
1. User Threads
2. Kernel Threads
User threads, are above the kernel and without kernel support. These are
the threads that application programmers use in their programs.
Kernel threads are supported within the kernel of the OS itself. All modern
OSs support kernel level threads, allowing the kernel to perform multiple
simultaneous tasks and/or to service multiple kernel system calls
simultaneously.
.
Prof. Gharu Anand N. 49
Lifecycle of Thread
The life cycle of a thread in an operating system involves the
creation, scheduling, execution, blocking, and termination. The
operating system plays a critical role in managing the life cycle of
threads, ensuring that they run efficiently and effectively.
Context It takes more time for context It takes less time for context
switching time switching. switching.
Resource Process consume more resources. Thread consume fewer resources.
Treatment by Different process are tread separately All the level peer threads are
OS by OS. treated as a single task by OS.
CreateProcess() ExitProcess()
Process Control fork() exit() wait()
WaitForSingleObject()
CreateFile() ReadFile()
File Manipulation open() read() write() close()
WriteFile() CloseHandle()
SetConsoleMode() ReadConsole()
Device Manipulation ioctl() read() write()
WriteConsole()
GetCurrentProcessID()
Information Maintenance getpid() alarm() sleep()
SetTimer() Sleeo()
CreatePipe() CreateFileMapping()
Communication pipe() shmget() mmap()
MapViewOfFile()
SetFileSecurity()
Protection InitlializeSecurityDescriptor() chmod() umask() chown()
Prof. Gharu Anand N. SetSecurityDescriptorGroup() 56
PROCESS
SCHEDULLING
1. Preemptive process:
In preemptive scheduling policy, a low priority process has to be suspend
its execution if high priority process is waiting in the same queue for its
execution.
3. Priority Scheduling
TAT=FT-AT WT=TAT-BT
Time Quantum is 5
Processes with same priority are executed on first come first served
basis.
Email : [email protected]