0% found this document useful (0 votes)
14 views74 pages

Os Unit1

The document provides a comprehensive overview of operating systems, detailing their definitions, goals, structures, and various types such as batch, multiprogramming, time-sharing, real-time, and distributed operating systems. It discusses the essential components of an operating system, including process management, file management, network management, and memory management. Additionally, it highlights the advantages and disadvantages of different operating systems, along with examples of each type.

Uploaded by

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

Os Unit1

The document provides a comprehensive overview of operating systems, detailing their definitions, goals, structures, and various types such as batch, multiprogramming, time-sharing, real-time, and distributed operating systems. It discusses the essential components of an operating system, including process management, file management, network management, and memory management. Additionally, it highlights the advantages and disadvantages of different operating systems, along with examples of each type.

Uploaded by

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

OPERATING SYSTEMS

SUBJECT CODE: 22PC0CS08

II B. tech -II Semester

DEPARTMENT OF SPECIAL BATCH

AY: 2023-2024
OPERATING SYSTEMS

UNIT - 1

Operating System - Introduction, Structures - Simple Batch,


Multi programmed, Time-shared, Personal Computer, Parallel,
Distributed Systems, Real-Time Systems, System components,
Operating System services, System Calls
Process - Process concepts and scheduling, Operations on
processes, Cooperating Processes, Threads
Concept to OS
An operating system is an interface between the computer user and the hardware device.
An operating system is a construct that allows the user application programs to interact with the system
hardware.
Operating system by itself does not provide any function but it provides an atmosphere in which different
applications and programs can do useful work.
Operating system coordinates between the hardware and the application programs.
Goals of OS
 The operating system mainly controls the allocation and use of the computing System’s
resources among the various user and tasks.
 It mainly provides an interface between the computer hardware and the programmer that
simplifies and makes feasible for coding, creation of application programs and debugging
In general, an operating system has three major goals. These are:
Convenience
An operating system should make a computer easy and convenient to use. The interface should
make the interaction with a computer system simple and hassle free.
Efficiency
The operating system should provide hardware resources to the different application programs in
such a way to maximize efficiency.
Evolution Ability
The operating system should not hinder the evolution of the computer system. This means that any
new functions should be easily integrated with the computer without disrupting the working of the
operating system.
Generations of OS
Structure of the OS
Operating system can be implemented with the help of various structures. The structure of the OS depends
mainly on how the various common components of the operating system are interconnected and melded into
the kernel. Depending on this we have following structures of the operating system:
1. Simple structure:
 Such operating systems do not have well defined structure and are small, simple and limited systems.
 The interfaces and levels of functionality are not well separated.
 MS-DOS is an example of such operating system. In MS-DOS application programs are able to access the
basic I/O routines.
 These types of operating system cause the entire system to crash if one of the user programs fails.
Diagram of the structure of MS-DOS is shown below.
Structure of the OS
2. Monolithic operating system:
The monolithic operating system is a very basic operating system in which file management, memory
management, device management, and process management is directly controlled within the kernel. All these
components like file management, memory management etc. are located within the kernel.
Functionality of the OS is invoked with simple function calls within the kernel, which is one large program.
Device drivers are loaded into the running kernel and become part of the kernel.
Structure of the OS
3. Layered structure:
An OS can be broken into pieces and retain much more control on system.
In this structure the OS is broken into number of layers (levels).
The bottom layer (layer 0) is the hardware and the topmost layer (layer N) is the user interface.
These layers are so designed that each layer uses the functions of the lower level layers only.
This simplifies the debugging process as if lower level layers are debugged and an error occurs during
debugging then the error must be on that layer only as the lower level layers have already been debugged.
The main disadvantage of this structure is that at each layer, the data needs to be modified and passed on
which adds overhead to the system.
Moreover careful planning of the layers is necessary as a layer can use only lower level layers. UNIX is an
example of this structure.
Structure of the OS
4. Micro-Kernel Operating System:
 This structure designs the operating system by removing all non-essential components from the kernel and
implementing them as system and user programs. This result in a smaller kernel called the micro-kernel.
Moves as much from the kernel into user space
Communication takes place between user modules using message passing
 Thus it is more secure and reliable as if a service fails then rest of the operating system remains untouched.
Mac OS is an example of this type of OS.
Types of Operating System
Some Widely Used Operating Systems Are As Follows
Batch Operating System
Multiprogramming Operating System
Time Sharing Operating System(Multi-Tasking)
Multiprocessor(Parallel) Operating System
Real-Time Operating System
Network Operating System
Mobile Operating System(Hand-Held)
Distributed Operating System
Batch Operating System
This type of operating system does not interact with the computer directly.
There is an operator which takes similar jobs having the same requirement and group them into batches.
It is the responsibility of the operator to sort jobs with similar needs.
In these, the jobs with similar needs were batched up and executed together. Then the results of these jobs
were sent back to the respective programmer.
Batch Operating System
Advantages:
It is very difficult to guess or know the time required for any job to complete. Processors of the batch systems
know how long the job would be when it is in queue
Multiple users can share the batch systems
The idle time for the batch system is very less
It is easy to manage large work repeatedly in batch systems

Disadvantages:
The computer operators should be well known with batch systems
Batch systems are hard to debug
It is sometimes costly
The other jobs will have to wait for an unknown time if any job fails

Examples of Batch based Operating System: Payroll System, Bank Statements, etc.
Multiprogramming Operating System
To overcome the problem of under utilization of CPU and main memory, the multi-programming was
introduced. The multi-programming is interleaved execution of multiple jobs by the same computer.
In Multiprogramming system, CPU will never be idle and keeps on processing. In this the operating system
picks up and begins to execute one of the jobs from memory. Once this job needs an I/O operation operating
system switches to another job (CPU and OS always busy).
Multiprogramming Operating System
An OS does the following activities related to multiprogramming.
The operating system keeps several jobs in memory at a time.
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.
Multiprogramming operating systems monitor the state of all active programs and system resources using
memory management programs to ensures that the CPU is never idle, unless there are no jobs to process.

Advantages
High and efficient CPU utilization.
User feels that many programs are allotted CPU almost simultaneously.

Disadvantages
CPU scheduling is required.
To accommodate many jobs in memory, memory management is required.
Time-Sharing Operating System
In this operating system allows multiple users to share the system simultaneously.
Each user is provided a time slice and the processor switches rapidly among the users according to it.
More than one processes are being executed at a particular time with the help of the time-sharing concept.
So, in the time-sharing environment, we decide a time that is called time quantum and when the process
starts its execution then the execution continues for only that amount of time and after that, other processes
will be given chance for that amount of time only. In the next cycle, the first process will again come for its
execution and it will be executed for that time quantum only and again next process will come. This process
will continue.
Time-Sharing Operating System
Advantages:
Since equal time quantum is given to each process, so each process gets equal opportunity to execute.
CPU will be busy in most of the cases.
Provides the advantage of quick response.
Avoids duplication of software.
Reduces CPU idle time.

Disadvantages:
Reliability problem
One must have to take care of the security and integrity of user programs and data
Data communication problem

Examples of Time-Sharing OSs are: Multics, Unix, etc.


Multiprocessor(Parallel) Operating System
These operating systems have multiple processors working together in parallel. These processors share the
system resources such as bus, clock, memory etc.
The main advantage of multiprocessor system is to get more work done in a shorter period of time. Moreover,
multiprocessor systems prove more reliable in the situations of failure of one processor.
Example: Windows NT, 2000, XP, and Unix
Real-Time Operating Systems
These types of OSs serve real-time systems. The time interval required to process and respond to inputs is
very small. This time interval is called response time.
Real-time systems are used when there are time requirements that are very strict like missile systems, air
traffic control systems, robots, etc.
Two types of Real-Time Operating System which are as follows:
Hard Real-Time Systems: These OSs are meant for applications where time constraints are very strict and
even the shortest possible delay is not acceptable. These systems are built for saving life like automatic
parachutes or airbags which are required to be readily available in case of any accident. Virtual memory is
rarely found in these systems.
Soft Real-Time Systems: These OSs are for applications where for time-constraint is less strict and executed
based on the priority.
Real-Time Operating Systems
Advantages of RTOS:
Maximum Consumption: Maximum utilization of devices and system, thus more output from all the resources
Task Shifting: The time assigned for shifting tasks in these systems are very less. For example, in older systems, it takes
about 10 microseconds in shifting one task to another, and in the latest systems, it takes 3 microseconds.
Focus on Application: Focus on running applications and less importance to applications which are in the queue.
Error Free: These types of systems are error-free.
Memory Allocation: Memory allocation is best managed in these types of systems.

Disadvantages of RTOS:
Limited Tasks: Very few tasks run at the same time and their concentration is very less on few applications to avoid
errors.
Use heavy system resources: Sometimes the system resources are not so good and they are expensive as well.
Complex Algorithms: The algorithms are very complex and difficult for the designer to write on.

Examples of Real-Time Operating Systems are: Scientific experiments, medical imaging systems, industrial control
systems, weapon systems, robots, air traffic control systems, etc.
Network Operating System
These systems run on a server and provide the capability to manage data, users, groups, security,
applications, and other networking functions.
These types of operating systems allow shared access of files, printers, security, applications, and other
networking functions over a small private network.
One more important aspect of Network Operating Systems is that all the users are well aware of the
underlying configuration, of all other users within the network, their individual connections, etc. and that’s
why these computers are popularly known as tightly coupled systems. (with different operating systems)
Network Operating System
Advantages of Network Operating System:
Highly stable centralized servers
Security concerns are handled through servers
New technologies and hardware up-gradation are easily integrated into the system
Server access is possible remotely from different locations and types of systems

Disadvantages of Network Operating System:


Servers are costly
User has to depend on a central location for most operations
Maintenance and updates are required regularly

Examples of Network Operating System are: Microsoft Windows Server 2003, Microsoft Windows Server
2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD, etc.
Mobile Operating System

A mobile operating system (mobile OS) is an OS built exclusively for a mobile device, such as a
smartphone, personal digital assistant (PDA), tablet or other embedded mobile OS.
A mobile OS is responsible for identifying and defining mobile device features and functions, including
keypads, application synchronization, email, thumbwheel and text messaging.
A mobile OS is similar to a standard OS (like Windows, Linux, and Mac) but is relatively simple and light
and primarily manages the wireless variations of local and broadband connections, mobile multimedia and
various input methods.
Mobile Operating System
It is an Operating System for mobiles, tablets, 2-in-1 PC’s (that can be convert to laptop mode or detach
and work as tablet mode.
Mobile OS have majority use since (2017)
Previously (1993)---Embedded systems
1993-1999---Pen Point OS (APRIL 1993)
APPLE LAUNCHES (NEWTON OS)
 1994---MARCH---Magic Cap OS
AUG---first smart phone(IBM) with touch screen
 1996----march ---palm OS
AUG---Nokia---(PEN/GEOS)
2019------jan /windows 10----IOS/android
September—Apple-ios13-----Iphone11
Smart Watch OS6---ipad---7th Gen
 And soon………..
Distributed Operating Systems
These types of the operating system is a recent advancement in the world of computer technology and are
being widely accepted all over the world.
 Various autonomous interconnected computers communicate with each other using a shared communication
network.
Independent systems possess their own memory unit and CPU. These are referred to as loosely coupled
systems or distributed systems. These system’s processors differ in size and function.
The major benefit of working with these types of the operating system is that it is always possible that one
user can access the files or software which are not actually present on his system but some other system
connected within this network i.e., remote access is enabled within the devices connected in that network.
Distributed Operating Systems
Advantages:
Failure of one system will not affect the other network communication, as all systems are independent from
each other
Electronic mail increases the data exchange speed (sending the data through Email)
Since resources are being shared, computation is highly fast and durable
Load on host computer reduces
These systems are easily scalable as many systems can be easily added to the network
Delay in data processing reduces
Disadvantages:
Failure of the main network will stop the entire communication
These types of systems are not readily available as they are very expensive. Not only that the underlying
software is highly complex and not understood well yet
Example: LOCUS(LOCUS is a distributed operating system which supports transparent access to data
through a network wide file system, permits automatic replication of storage, supports transparent distributed
process execution) , etc.
OS System Components
•An operating system is a large and complex system that can only be created by partitioning into small parts.
These pieces should be a well-defined part of the system, carefully defining inputs, outputs, and functions.
•The components of an operating system play a key role to make a variety of computer system parts work
together. There are the following components of an operating system, such as:
 Process Management
 File Management
 Network Management
 Main Memory Management
 Secondary Storage Management
 I/O Device Management
 Security Management
 Command Interpreter System
OS System Components
Process Management
•The process management component is a procedure for managing many processes running simultaneously
on the operating system. Every running software application program has one or more processes associated
with them.
•For example, when you use a search engine like Chrome, there is a process running for that browser
program.
•Process management keeps processes running efficiently. It also uses memory allocated to them and shutting
them down when needed.
•The execution of a process must be sequential so, at least one instruction should be executed on behalf of the
process.
Functions of process management
Process creation and deletion.
Suspension and resumption.
Synchronization process
Communication process
OS System Components
2. File Management
A file is a set of related information defined by its creator. It commonly represents programs (both source and
object forms) and data. Data files can be alphabetic, numeric, or alphanumeric.
Function of file management
File and directory creation and deletion.
For manipulating files and directories.
Mapping files onto secondary storage.
Backup files on stable storage media.
OS System Components

3. Network Management
•Network management is the process of administering and managing computer networks.
•It includes performance management, provisioning of networks, fault analysis, and maintaining the quality
of service.

Function of Network management


Network administration
Network maintenance
Network operation
Network provisioning
Network security
OS System Components
4. Main Memory management
•Main memory is a large array of storage or bytes, which has an address. The memory management process is
conducted by using a sequence of reads or writes of specific memory addresses.
•It should be mapped to absolute addresses and loaded inside the memory to execute a program. The selection
of a memory management method depends on several factors.
Function of Main Memory management
It helps you to keep track of primary memory.
Determine what part of it are in use by whom, what
part is not in use.
In a multiprogramming system, the OS decides
which process will get memory and how much.
Allocates the memory when a process requests.
It also de-allocates the memory when a process no
longer requires or has been terminated.
OS System Components
5. Secondary-Storage Management
•The most important task of a computer system is to execute programs.
•These programs help you to access the data from the main memory during execution.
•This memory of the computer is very small to store all data and programs permanently.
•The computer system offers secondary storage to back up the main memory.

Functions of Secondary storage management


Storage allocation
Free space management
Disk scheduling
OS System Components
6. I/O Device Management
Functions of I/O management
The I/O management system offers the following functions, such as:
•It offers a buffer caching system
•It provides general device driver code
•It provides drivers for particular hardware devices.
•I/O helps you to know the individualities of a specific device.
OS System Components
7. Security Management
•The various processes in an operating system need to be secured from other activities. Therefore, various
mechanisms can ensure those processes that want to operate files, memory CPU, and other hardware
resources should have proper authorization from the operating system.
•Security refers to a mechanism for controlling the access of programs, processes, or users to the resources
defined by computer controls to be imposed, together with some means of enforcement.
OS System Components
8. Command Interpreter System
•One of the most important components of an operating system is its command interpreter.
•The command interpreter is the primary interface between the user and the rest of the system.
OS Services
Program execution
User Interface
I/O Management
File Management
Communication
Error Detection
Accounting
Resource Allocation
File Protection and Security
OS Services
Program execution
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.

User Interface:
GUI: graphical user interface : windows environment (ex: window interface by using the pointer
device(mouse) we will operate the system and keyboard to enter text etc…
Batch Interface: all commands and directives are entered in to files (these files are executed to control the
commands or access the system
CLI: Command Line Interface: user enters commands to access system (unix / linux commands in
terminal)
OS Services
I/O Management:
A running program may require I/O, which may involve a file or an I/O device.
For efficiency and protection , users cannot control I/O devices directly, therefore, the operating system
must provide a means to do I/O.(ex: user wants to take printouts OS should provide connection between file
and printer device)
File system Management:
The file system is of particular interest (how to manage files)
Obviously programs need to read and write files and directories.
They also need to create and delete them by name, search for given file etc…
Some operating systems include permissions management to allow or deny access to files or directories
based on file ownership(personal file).
Communications:
There are many circumstances in which one process needs to exchange information with another processes
This communication may be on the same computer or on different computers(tied into a network) via shared
memory or message passing (distributed/network OS) which is done by operating system
OS Services
Error Detection:
The OS needs to be detecting and correcting errors constantly.
Errors may occur in the
CPU and Memory hardware(such as memory error or power failure)
I/O devices(such as parity error on disk, a connection failure on network, or lack of paper in the printer)
A parity error is an error that results from irregular changes to data.
User program(such as arithmetic overflow, an attempt to access an illegal memory location etc..
In the above cases the OS should take appropriate action to control the errors. In worst cases the system
itself will hang / struck. So we need to restart the computer.

Accounting:
we want to keep track of which users use how much and what kind of computer resources.
This record keeping may be used for accounting or for usage statistics (may be valuable tool for researchers
who wish to reconfigure the system to improve computing services)
OS Services
Resource allocation:
when multiple jobs or users running at same time then resources must be allocated to each of them
The OS manages many different types of resources
CPU cycles(scheduling algorithms), main memory, file storage (special allocation code)
I/O devices(request and release codes)(request for printer, scanner, mouse, keyboard etc..)
File Protection and Security:
Protection:
When several separate processes execute concurrently , it should not be possible for one process to
interfere with another (one process execution should not interrupt another process)
Each process should access the system resources in control(resources should not be wasted unnecessarily).
Security:
Security for system from outsiders is also important
So each user has to authenticate himself/herself to the system
By using password to (Access the system resources).
System Calls
System call is the programmatic way in which a computer program requests a service from the kernel of the
operating system it is executed on.
The interface between a process and an operating system is provided by system calls
In general, system calls are available as assembly language instructions.
System calls are usually made when a process in user mode requires access to a resource. Then it requests
the kernel to provide the resource via a system call.
When a System Calls requires
In general, system calls are required in the following situations −
If a file system requires the creation or deletion of files. Reading and writing from files also require a
system call.
Creation and management of new processes.
Network connections also require system calls. This includes sending and receiving packets.
Access to a hardware devices such as a printer, scanner etc. requires a system call.
Types of System Calls
There are mainly five types of system calls. These are explained in detail as follows
1. Process Control
These system calls deal with processes such as create, end, abort, terminate, allocate and free memory, etc.
Functions:
End and Abort
Load and Execute
Create Process and Terminate Process
Wait and Signed Event
Allocate and free memory
2. File Management
These system calls are responsible for file manipulation such as creating a file, reading a file, writing into a
file etc.
Functions:
Create a file
Delete file
Open and close file
Read, write, and reposition
Get and set file attributes
Types of System Calls
3. Device Management: These system calls are responsible for device manipulation such as reading from
device buffers, writing into device buffers etc.
Functions:
Request and release device
Logically attach/ detach devices
Get and Set device attributes
4. Information Maintenance: These system calls handle information and its transfer between the operating
system and the user program.
Functions:
Get or set time and date
Get process and device attributes
5. Communication: These system calls are useful for inter process communication. They also deal with
creating and deleting a communication connection.
Functions:
Create, delete communications connections
Send, receive message
Help OS to transfer status information

Types of System Calls
6. Protection and Security:
Protection:
When several separate processes execute concurrently , it should not be possible for one process to
interfere with another (one process execution should not interrupt another process)
Each process should access the system resources in control(resources should not be wasted unnecessarily).
Security:
Security for system from outsiders is also important
So each user has to authenticate himself/herself to the system
By using password to (Access the system resources).
Examples of System Calls
Process Definition
A process is a program in execution which then forms the basis of all
computation.
Process executes instructions sequentially, one at a time, until completion
A process is defined as an entity which represents the basic unit of work to be
implemented in the system
Program is passive entity stored on disk (executable file), process is active
program becomes process when executable file loaded into memory
 Process needs CPU, memory, I/O, files, Initialization data resources to
accomplish its task

Process in Memory
Stack: The process Stack contains the temporary data such as method/function
parameters, return address and local variables.
Heap: This is dynamically allocated memory to a process during its run time.
Text: This includes the current activity represented by the value of Program
Counter and the contents of the processor's registers.
Data: This section contains the global and static variables.
 Current activity including program counter, processor registers
Process Relationship
A process may create several number of processes (via A create process system call) during the course of
execution.
The creating process is called a parent process, and the new processes are called the children of that
process.
Each of these new processes may intern create other processes forming a tree of processes.
Parent process create children processes, which, in turn create other processes, forming a tree of processes.
When a process creates a new process, two possibilities exists in terms of execution.
parent
The parent continues to execute concurrently with its children
The parent waits until some (or) all of its children have terminated

child child child

child child
child child child
Operations on processes:
Process Creation:
 When a process creates a new process, two possibilities exists in terms of execution.
 The parent continues to execute concurrently with its children
 The parent waits until some (or) all of its children have terminated
Address space
 Child duplicate of parent. (child uses same resources which the parent is using)
 Child has a program loaded into it.
 Child process has a new program loaded into it which is different from parent program(then child will request for
other resources which are different from parent resources).
 Generally process identified and managed via Process id(PID)
Possible resource sharing:
 Parent and children share all resources.
 Children share subset of parent’s resources.(some services of parent)
 Some times the resources may be different for parent and child.
Possible execution:
 Parent and children execute concurrently.
 Parent waits until all the children gets terminated.
 fork() system call creates new process
 exec() system call used after a fork() to replace the process memory space with a new program
Process Termination:
Process executes last statement and then asks the operating system to delete it using the exit() system call.
 Returns status data from child to parent (via wait())
 Process resources are de-allocated by operating system
Parent may terminate the execution of children processes using the abort() system call. Some reasons for
doing so:
 Child has exceeded allocated resources
 Task assigned to child is no longer required
 The parent is exiting and the operating systems does not allow a child to continue if its parent terminates
 Some operating systems do not allow child to exists if its parent has terminated. If a process terminates,
then all its children must also be terminated.
 cascading termination. All children, grandchildren, etc. are terminated.
 The termination is initiated by the operating system.
The parent process may wait for termination of a child process by using the wait()system call. The call
returns status information and the pid of the terminated process
pid = wait(&status);
If no parent waiting (did not invoke wait()), process is a zombie
If parent terminated without invoking wait , process is an orphan
Basic Operations on the Process
Creation
Once the process is created, it will be ready and come into the ready queue (main memory) and will be ready
for the execution.
Scheduling
Out of the many processes present in the ready queue, the Operating system chooses one process and start
executing it. Selecting the process which is to be executed next, is known as scheduling.
Execution
Once the process is scheduled for the execution, the processor starts executing it. Process may come to the
blocked or wait state during the execution then in that case the processor starts executing the other processes.
Deletion/killing
Once the purpose of the process gets over then the OS will kill the process. The Context of the process
(PCB) will be deleted and the process gets terminated by the Operating system.
Different states of a Process (Life Cycle of the Process)
As a process executes, it changes state
 New
 Ready
 Running
 Waiting or Blocked
 Terminated or Completed
Process States (Life Cycle of the Process)
 New: This is the state when the process is being created. It is the initial state in the process life cycle.
 Ready: After the creation of a process, the process enters the ready state i.e. the process is loaded into the main
memory. The process here is ready to run and is waiting to get the CPU time for its execution. The process is waiting to
be assigned to a processor
 Running: process is being executed i.e The process is chosen by CPU for execution and the instructions within the
process are executed by any one of the available CPU core.
 Waiting or Blocked: The process is waiting for some event to occur i.e Whenever the process requests access to I/O or
needs input from the user or needs access to a critical region(the lock for which is already acquired) it enters the
blocked or wait state. The process continues to wait in the main memory and does not require CPU. Once the I/O
operation is completed the process goes to the ready state.
 Terminated or Completed: When a process finishes its execution, it comes in the termination state. All the context of
the process (Process Control Block) will also be deleted the process will be terminated by the Operating system.
Other Process States:
 Suspend ready – Process that was initially in the ready state but were swapped out of main memory(refer Virtual
Memory topic) and placed onto external storage by scheduler are said to be in suspend ready state. The process will
transition back to ready state whenever the process is again brought onto the main memory.
 Suspend wait or suspend blocked – Similar to suspend ready but uses the process which was performing I/O
operation and lack of main memory caused them to move to secondary memory. When work is finished it may go to
suspend ready.
Process State Transitions
Process State Transitions
Process Control Block (PCB)
It is also called as Central repository(Store) for a process.
Information associated with each process (also called task control block)
process control stores many data items as follows that are needed for efficient
process management
 Pointer: It contains the address of another process which is present in
the ready queue.
 Process State: This specifies the process state i.e. new, ready, running,
waiting or terminated.
 Process Number: This shows the number of the particular process.
 Program Counter: This contains the address of the next instruction
that needs to be executed in the process.
 Registers: This specifies the registers that are used by the process.
They may include accumulators, index registers, stack pointers, general
purpose registers etc.
 List of Open Files: These are the different files that are associated with
the process
Process Control Block (PCB)
CPU Scheduling Information: The process priority, pointers to scheduling
queues etc. is the CPU scheduling information that is contained in the PCB.
This may also include any other scheduling parameters.
Memory Management Information: The memory management information
includes the page tables or the segment tables depending on the memory system
used. It also contains the value of the base registers, limit registers etc.
I/O Status Information: This information includes the list of I/O devices
used by the process, the list of files etc.
Accounting information: The time limits, account numbers, amount of CPU
used, process numbers etc. are all a part of the PCB accounting information.
Location of the Process Control Block: The process control block is kept in
a memory area that is protected from the normal user access. This is done
because it contains important process information. Some of the operating
systems place the PCB at the beginning of the kernel stack for the process as it
is a safe location.
Context Switching
A context switching is a process that involves switching of the CPU from one process or task to another.
In computing, a context switch is the process of storing the state of a process or thread, so that it can be
restored and resume execution at a later point. This allows multiple processes to share a single central
processing unit (CPU), and is an essential feature of a multitasking operating system.
Context Switching Steps
The steps involved in context switching are as follows −
 Save the context of the process that is currently running on the CPU. Update the process control block
and other important fields.
 Update the process control block of the selected process. This includes updating the process state to
running.
 Update the memory management data structures as required.
 Restore the context of the process that was previously running when it is loaded again on the processor.
This is done by loading the previous values of the process control block and registers.
Information to be stored for context switching in PCB is:-
1) Program counter 2) Scheduling information
3) Changed state 4) Accounting Information
5) Base and Limit register
CPU Switch From Process to Process
Context Switching
Example of Context Switching
 Suppose that multiple processes are stored in a Process Control Block
(PCB).
 One process is running state to execute its task with the use of CPUs.
 As the process is running, another process arrives in the ready queue,
which has a high priority of completing its task using CPU.
 Here we used context switching that switches the current process with
the new process requiring the CPU to finish its tasks.
 While switching the process, a context switch saves the status of the old
process in registers.
 When the process reloads into the CPU, it starts the execution of the
process when the new process stops the old process.
 If we do not save the state of the process, we have to start its execution
at the initial level.
 In this way, context switching helps the operating system to switch
between the processes, store or reload the process when it requires
executing its tasks.
Cooperating Processes
•Cooperating Processes are those processes that depend on other processes or processes.
•They work together to achieve a common task in an operating system.
•These processes interact with each other by sharing the resources such as CPU, memory, and I/O devices to
complete the task.

Advantages of Cooperating Process:


• Information Sharing
• Modularity
• Computation Speedup
• Convenience
Cooperating Processes
Methods of Cooperating Process: Cooperating processes may coordinate with each other by sharing data or
messages.
Cooperation by Communication
Cooperation by sharing
THANK YOU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy