Process
A process is basically a program in execution.
The execution of a process must progress in a
sequential fashion.
• The Text section is made up of the compiled program
code, read in from non-volatile storage when the
program is launched.
• The Data section is made up the global and static
variables, allocated and initialized prior to executing the
main.
• The Heap is used for the dynamic memory allocation,
and is managed via calls to new, delete, malloc, free, etc.
• The Stack is used for local variables. Space on the stack
is reserved for local variables when they are declared.
Process states
• New to Ready
• The operating system creates a process. And prepares the process to be executed by, then the operating system
moves the process into the ready queue.
• Ready to Running
• When it is time to select a process to run, the operating system selects one of the jobs for the ready queue and
move the processes from the ready state to the running state.
• Running to Terminated
• When the execution of a process has completed then the operating system terminates that process from running
state. Sometimes the operating system terminates the processes for some other reasons also include time limit
exceeded, memory unavailable access violation, protection error, I/O failure, data misuse and so on.
• Running to Ready
• When the time slot for the processor expires or if the processor receives an interrupt signal, then the operating
system shifts the running process to the ready state.
• For example, process P1 is being executed by the processor, at that time processor, P2 generates an interrupt
signal to the processor. Then the processor compares the priorities of process P1 and P2. If P1>P2 then the
processor continues executing P1. Otherwise, the processor switches to process P2, and process P1 is moved to
the ready state.
• Running to Waiting
• A process is put into the waiting state if the process needs an event to occur, or an I/O device is to read. The
operating system does not provide the I/O or event immediately then the process is moved to the waiting state
by the operating system.
• Waiting to Ready
• A process in the blocked state is moved to the ready state when the event for which it has been waiting occurs.
• For example, a process is in running state needs an I/O devices, then the process moved to wait or blocked state.
When the I/O device is provided by the operating system, the process moved to the ready state from waiting or
blocked state.
Process Control Block(PCB)
• Process state: A process can be new, ready, running, waiting, etc.
• Program counter: The program counter means pointer to the the
address of the next instruction, which should be executed for that
process.
• CPU registers: This component includes accumulators, index and
general-purpose registers, and information of condition code.
• CPU scheduling information: This component includes a process
priority, pointers for scheduling queues, and various other scheduling
parameters.
• Accounting and business information: It includes the amount of CPU
and time utilities like real time used, job or process numbers, etc.
• Memory-management information: This information includes the value
of the base and limit registers, the page, or segment tables. This
depends on the memory system, which is used by the operating system.
• I/O status information: This block includes a list of open files, the list of
I/O devices that are allocated to the process, etc.
Intercommunication process communication
A process can be of two types:
•Independent process.
•Co-operating process
The communication between these processes can
be seen as a method of co-operation between them.
Processes can communicate with each other
through both:
•Shared Memory
•Message passing
1] shared memory
shared memory
• Communication between processes using shared memory requires
processes to share some variable and it completely depends on
how programmer will implement it. Suppose process1 and process2
are executing simultaneously and they share some resources or use
some information from another process. Process1 generate
information about certain computations or resources being used
and keeps it as a record in shared memory. When process2 needs
to use the shared information, it will check in the record stored in
shared memory and take note of the information generated by
process1 and act accordingly. Processes can use shared memory for
extracting information as a record from another process as well as
for delivering any specific information to other processes
2] Messaging Passing Method
• In this method, processes communicate with each
other without using any kind of shared memory. If two
processes p1 and p2 want to communicate with each
other, they proceed as follows:
• Establish a communication link (if a link already exists,
no need to establish it again.)
• Start exchanging messages using basic primitives.
We need at least two primitives:
– send(message, destinaion) or send(message)
– receive(message, host) or receive(message)
• The message size can be of fixed size or of variable size. If it
is of fixed size, it is easy for an OS designer but complicated
for a programmer and if it is of variable size then it is easy
for a programmer but complicated for the OS designer. A
standard message can have two parts: header and body.
The header part is used for storing message type,
destination id, source id, message length, and control
information. The control information contains information
like what to do if runs out of buffer space, sequence
number, priority. Generally, message is sent using FIFO
style.
Synchronous and Asynchronous
Message Passing:
• Synchronous and Asynchronous Message Passing:
A process that is blocked is one that is waiting for some event, such
as a resource becoming available or the completion of an I/O
operation.
• IPC is possible between the processes on same computer as well as
on the processes running on different computer i.e. in
networked/distributed system. In both cases, the process may or may
not be blocked while sending a message or attempting to receive a
message so message passing may be blocking or non-blocking.
Blocking is considered synchronous and blocking send means the
sender will be blocked until the message is received by receiver.
Similarly, blocking receive has the receiver block until a message is
available. Non-blocking is considered asynchronous and Non-
blocking send has the sender sends the message and continue.
Similarly, Non-blocking receive has the receiver receive a valid
message or null.
• here are numerous reasons for providing an environment or situation which
allows process co-operation:
•
• Information sharing: Since some users may be interested in the same piece of
information (for example, a shared file), you must provide a situation for allowing
concurrent access to that information.
• Computation speedup: If you want a particular work to run fast, you must break it
into sub-tasks where each of them will get executed in parallel with the other
tasks. Note that such a speed-up can be attained only when the computer has
compound or various processing elements like CPUs or I/O channels.
• Modularity: You may want to build the system in a modular way by dividing the
system functions into split processes or threads.
• Convenience: Even a single user may work on many tasks at a time. For example,
a user may be editing, formatting, printing, and compiling in parallel.
Client –server communication
Sockets
Client/Server communication involves two
components, namely a client and a server. They
are usually multiple clients in communication
with a single server. The clients send requests to
the server and the server responds to the client
requests.
There are three main methods to client/server
communication. These are given as follows −
• Sockets
• Sockets facilitate communication between two processes
on the same machine or different machines. They are
used in a client/server framework and consist of the IP
address and port number. Many application protocols use
sockets for data connection and data transfer between a
client and a server.
• Socket communication is quite low-level as sockets only
transfer an unstructured byte stream across processes.
The structure on the byte stream is imposed by the client
and server applications.
Remote Procedure Calls
• These are interprocess communication
techniques that are used for client-server based
applications. A remote procedure call is also
known as a subroutine call or a function call.
• A client has a request that the RPC translates
and sends to the server. This request may be a
procedure or a function call to a remote server.
When the server receives the request, it sends
the required response back to the client.
Pipes
• These are interprocess communication methods that contain two
end points. Data is entered from one end of the pipe by a process
and consumed from the other end by the other process.
• The two different types of pipes are ordinary pipes and named
pipes. Ordinary pipes only allow one way communication. For two
way communication, two pipes are required. Ordinary pipes have
a parent child relationship between the processes as the pipes
can only be accessed by processes that created or inherited them.
• Named pipes are more powerful than ordinary pipes and allow
two way communication. These pipes exist even after the
processes using them have terminated. They need to be explicitly
deleted when not required anymore
• Process Scheduling handles the selection of a process for
the processor on the basis of a scheduling algorithm and
also the removal of a process from the processor. It is an
important part of multiprogramming operating system.
• There are many scheduling queues that are used in
process scheduling. When the processes enter the
system, they are put into the job queue. The processes
that are ready to execute in the main memory are kept
in the ready queue. The processes that are waiting for
the I/O device are kept in the I/O device queue.
Schedular
•Long Term Scheduler
•Short Term Scheduler
•Medium Term Scheduler
Long Term Scheduler
• The job scheduler or long-term scheduler selects processes
from the storage pool in the secondary memory and loads
them into the ready queue in the main memory for execution.
• The long-term scheduler controls the degree of
multiprogramming. It must select a careful mixture of I/O
bound and CPU bound processes to yield optimum system
throughput. If it selects too many CPU bound processes then
the I/O devices are idle and if it selects too many I/O bound
processes then the processor has nothing to do.
• The job of the long-term scheduler is very important and
directly affects the system for a long time.
Short Term Scheduler
• The short-term scheduler selects one of the processes from the
ready queue and schedules them for execution. A scheduling
algorithm is used to decide which process will be scheduled for
execution next.
• The short-term scheduler executes much more frequently than
the long-term scheduler as a process may execute only for a few
milliseconds.
• The choices of the short term scheduler are very important. If it
selects a process with a long burst time, then all the processes
after that will have to wait for a long time in the ready queue.
This is known as starvation and it may happen if a wrong
decision is made by the short-term scheduler.
Medium Term Scheduler
• The medium-term scheduler swaps out a
process from main memory. It can again swap
in the process later from the point it stopped
executing. This can also be called as
suspending and resuming the process.
• This is helpful in reducing the degree of
multiprogramming. Swapping is also useful to
improve the mix of I/O bound and CPU bound
processes in the memory.

Processprehsjsjsjskakwkwkejjdbdbdjj.pptx

  • 1.
    Process A process isbasically a program in execution. The execution of a process must progress in a sequential fashion.
  • 2.
    • The Textsection is made up of the compiled program code, read in from non-volatile storage when the program is launched. • The Data section is made up the global and static variables, allocated and initialized prior to executing the main. • The Heap is used for the dynamic memory allocation, and is managed via calls to new, delete, malloc, free, etc. • The Stack is used for local variables. Space on the stack is reserved for local variables when they are declared.
  • 3.
  • 4.
    • New toReady • The operating system creates a process. And prepares the process to be executed by, then the operating system moves the process into the ready queue. • Ready to Running • When it is time to select a process to run, the operating system selects one of the jobs for the ready queue and move the processes from the ready state to the running state. • Running to Terminated • When the execution of a process has completed then the operating system terminates that process from running state. Sometimes the operating system terminates the processes for some other reasons also include time limit exceeded, memory unavailable access violation, protection error, I/O failure, data misuse and so on. • Running to Ready • When the time slot for the processor expires or if the processor receives an interrupt signal, then the operating system shifts the running process to the ready state. • For example, process P1 is being executed by the processor, at that time processor, P2 generates an interrupt signal to the processor. Then the processor compares the priorities of process P1 and P2. If P1>P2 then the processor continues executing P1. Otherwise, the processor switches to process P2, and process P1 is moved to the ready state. • Running to Waiting • A process is put into the waiting state if the process needs an event to occur, or an I/O device is to read. The operating system does not provide the I/O or event immediately then the process is moved to the waiting state by the operating system. • Waiting to Ready • A process in the blocked state is moved to the ready state when the event for which it has been waiting occurs. • For example, a process is in running state needs an I/O devices, then the process moved to wait or blocked state. When the I/O device is provided by the operating system, the process moved to the ready state from waiting or blocked state.
  • 5.
  • 6.
    • Process state:A process can be new, ready, running, waiting, etc. • Program counter: The program counter means pointer to the the address of the next instruction, which should be executed for that process. • CPU registers: This component includes accumulators, index and general-purpose registers, and information of condition code. • CPU scheduling information: This component includes a process priority, pointers for scheduling queues, and various other scheduling parameters. • Accounting and business information: It includes the amount of CPU and time utilities like real time used, job or process numbers, etc. • Memory-management information: This information includes the value of the base and limit registers, the page, or segment tables. This depends on the memory system, which is used by the operating system. • I/O status information: This block includes a list of open files, the list of I/O devices that are allocated to the process, etc.
  • 7.
    Intercommunication process communication Aprocess can be of two types: •Independent process. •Co-operating process The communication between these processes can be seen as a method of co-operation between them. Processes can communicate with each other through both: •Shared Memory •Message passing
  • 8.
  • 9.
    shared memory • Communicationbetween processes using shared memory requires processes to share some variable and it completely depends on how programmer will implement it. Suppose process1 and process2 are executing simultaneously and they share some resources or use some information from another process. Process1 generate information about certain computations or resources being used and keeps it as a record in shared memory. When process2 needs to use the shared information, it will check in the record stored in shared memory and take note of the information generated by process1 and act accordingly. Processes can use shared memory for extracting information as a record from another process as well as for delivering any specific information to other processes
  • 10.
  • 11.
    • In thismethod, processes communicate with each other without using any kind of shared memory. If two processes p1 and p2 want to communicate with each other, they proceed as follows: • Establish a communication link (if a link already exists, no need to establish it again.) • Start exchanging messages using basic primitives. We need at least two primitives: – send(message, destinaion) or send(message) – receive(message, host) or receive(message)
  • 12.
    • The messagesize can be of fixed size or of variable size. If it is of fixed size, it is easy for an OS designer but complicated for a programmer and if it is of variable size then it is easy for a programmer but complicated for the OS designer. A standard message can have two parts: header and body. The header part is used for storing message type, destination id, source id, message length, and control information. The control information contains information like what to do if runs out of buffer space, sequence number, priority. Generally, message is sent using FIFO style.
  • 13.
    Synchronous and Asynchronous MessagePassing: • Synchronous and Asynchronous Message Passing: A process that is blocked is one that is waiting for some event, such as a resource becoming available or the completion of an I/O operation. • IPC is possible between the processes on same computer as well as on the processes running on different computer i.e. in networked/distributed system. In both cases, the process may or may not be blocked while sending a message or attempting to receive a message so message passing may be blocking or non-blocking. Blocking is considered synchronous and blocking send means the sender will be blocked until the message is received by receiver. Similarly, blocking receive has the receiver block until a message is available. Non-blocking is considered asynchronous and Non- blocking send has the sender sends the message and continue. Similarly, Non-blocking receive has the receiver receive a valid message or null.
  • 14.
    • here arenumerous reasons for providing an environment or situation which allows process co-operation: • • Information sharing: Since some users may be interested in the same piece of information (for example, a shared file), you must provide a situation for allowing concurrent access to that information. • Computation speedup: If you want a particular work to run fast, you must break it into sub-tasks where each of them will get executed in parallel with the other tasks. Note that such a speed-up can be attained only when the computer has compound or various processing elements like CPUs or I/O channels. • Modularity: You may want to build the system in a modular way by dividing the system functions into split processes or threads. • Convenience: Even a single user may work on many tasks at a time. For example, a user may be editing, formatting, printing, and compiling in parallel.
  • 15.
    Client –server communication Sockets Client/Servercommunication involves two components, namely a client and a server. They are usually multiple clients in communication with a single server. The clients send requests to the server and the server responds to the client requests. There are three main methods to client/server communication. These are given as follows −
  • 16.
    • Sockets • Socketsfacilitate communication between two processes on the same machine or different machines. They are used in a client/server framework and consist of the IP address and port number. Many application protocols use sockets for data connection and data transfer between a client and a server. • Socket communication is quite low-level as sockets only transfer an unstructured byte stream across processes. The structure on the byte stream is imposed by the client and server applications.
  • 17.
  • 18.
    • These areinterprocess communication techniques that are used for client-server based applications. A remote procedure call is also known as a subroutine call or a function call. • A client has a request that the RPC translates and sends to the server. This request may be a procedure or a function call to a remote server. When the server receives the request, it sends the required response back to the client.
  • 19.
  • 20.
    • These areinterprocess communication methods that contain two end points. Data is entered from one end of the pipe by a process and consumed from the other end by the other process. • The two different types of pipes are ordinary pipes and named pipes. Ordinary pipes only allow one way communication. For two way communication, two pipes are required. Ordinary pipes have a parent child relationship between the processes as the pipes can only be accessed by processes that created or inherited them. • Named pipes are more powerful than ordinary pipes and allow two way communication. These pipes exist even after the processes using them have terminated. They need to be explicitly deleted when not required anymore
  • 21.
    • Process Schedulinghandles the selection of a process for the processor on the basis of a scheduling algorithm and also the removal of a process from the processor. It is an important part of multiprogramming operating system. • There are many scheduling queues that are used in process scheduling. When the processes enter the system, they are put into the job queue. The processes that are ready to execute in the main memory are kept in the ready queue. The processes that are waiting for the I/O device are kept in the I/O device queue.
  • 22.
    Schedular •Long Term Scheduler •ShortTerm Scheduler •Medium Term Scheduler
  • 23.
    Long Term Scheduler •The job scheduler or long-term scheduler selects processes from the storage pool in the secondary memory and loads them into the ready queue in the main memory for execution. • The long-term scheduler controls the degree of multiprogramming. It must select a careful mixture of I/O bound and CPU bound processes to yield optimum system throughput. If it selects too many CPU bound processes then the I/O devices are idle and if it selects too many I/O bound processes then the processor has nothing to do. • The job of the long-term scheduler is very important and directly affects the system for a long time.
  • 24.
    Short Term Scheduler •The short-term scheduler selects one of the processes from the ready queue and schedules them for execution. A scheduling algorithm is used to decide which process will be scheduled for execution next. • The short-term scheduler executes much more frequently than the long-term scheduler as a process may execute only for a few milliseconds. • The choices of the short term scheduler are very important. If it selects a process with a long burst time, then all the processes after that will have to wait for a long time in the ready queue. This is known as starvation and it may happen if a wrong decision is made by the short-term scheduler.
  • 25.
    Medium Term Scheduler •The medium-term scheduler swaps out a process from main memory. It can again swap in the process later from the point it stopped executing. This can also be called as suspending and resuming the process. • This is helpful in reducing the degree of multiprogramming. Swapping is also useful to improve the mix of I/O bound and CPU bound processes in the memory.