0% found this document useful (0 votes)
41 views

OS Unit I

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

OS Unit I

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

OPERATING SYSTEM

What is Operating System?


Operating System acts as an intermediary between the Computer user and
Computer hardware. It is a software program that manages the Computer hardware.
The purpose of an operating system is to provide an environment in which a
user can execute programs in a convenient and efficient manner.
 An operating system is a software which performs all the basic tasks like file
management, memory management, process management, handling input and
output, and controlling peripheral devices such as disk drives and printers.
 Some popular Operating Systems include Linux Operating System, Windows
Operating System, Chrome OS, Google’s Android, Apple’s iOS etc.
Working of Operating System
A Computer system can be divided into four components with hardware, the
operating system, the application programs and the users.

Services of Operating System


Following are a few common services provided by an operating system
1. Program execution
2. I/O operations
3. File System manipulation
4. Communication
5. Error Detection
6. Resource Allocation
7. Protection
1. Program Execution
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.
2. IO Operations:
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.
3. 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.
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 System provides an interface to create the backup of file system.
4. 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.
The OS handles routing and connection strategies, and the problems of contention
and security. Following are the major activities of an operating system with respect to
communication:

 Two processes often require data to be transferred between them


 Both the processes can be on one computer or on different computers, but are
connected through a computer network.
 Communication may be implemented by two methods, either by Shared
Memory or by Message Passing.

5.Error handling:
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices
or in the memory hardware. Following are the major activities of an operating system
with respect to error handling.

 The OS constantly checks for possible errors.


 The OS takes an appropriate action to ensure correct and consistent computing.

6.Resource Management:
In case of multi-user or multi-tasking environment, resources such as main memory,
CPU cycles and files storage are to be allocated to each user or job. Following are the
major activities of an operating system with respect to resource management.

 The OS manages all kinds of resources using schedulers.


 CPU scheduling algorithms are used for better utilization of CPU.

7.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.Protection refers to a mechanism or a way to control the access of programs,
processes, or users to the resources defined by a computer system. Following are the
major activities of an operating system with respect to protection.

 The OS ensures that all access to system resources is controlled.


 The OS ensures that external I/O devices are protected from invalid access
attempts.
 The OS provides authentication features for each user by means of passwords.

OPERATING SYSTEM TYPES


1.Multiuser OS:
In a multiuser OS, more than one user can use the same system at a same time through
the multi I/O terminal or through the network.
For example: windows, Linux, Mac, etc.
A multiuser OS uses timesharing to support multiple users.
2. Multiprocessing OS:
A multiprocessing OS can support the execution of multiple processes at the same
time. It uses multiple number of CPU. It is expensive in cost. However, the
processing speed will be faster. It is complex in its execution. Operating system like
Unix, 64bit edition of windows, server edition of windows, etc. are multiprocessing.

3.Multiprogramming OS:
In a multiprogramming OS more than one program can be used at the same time. It
may or may not be multiprocessing. In a single CPU system, multiple programs are
executed one after another by dividing the CPU into small time slice.
example: Windows, Mac, Linuxetc.

4. Multitasking OS:
In a multitasking system more than one task can be performed at the same time but
they are executed one after another through a single CPU by time sharing. For
example: Windows, Linux, Mac, Unixetc.
Multitasking OS are of two types:
a) Pre-emptive multitasking
b) Co-operative multitasking
In the pre-emptive multitasking, the OS allows CPU times slice to each program.
After each time slice, CPU executes another task. Example: Windows XP
In co-operative multitasking, a task can control CPU as long as it requires. However,
it will free CPU to execute another program if it doesn’t require CPU. Example:
windows 3.x, multi finder etc.

5. Multithreading:

A program in execution is known as process. A process can be further divided into


multiple sub-processers. These sub-processers are known as threads. A multi-threading
OS can divide process into threads and execute those threads. This increases operating
speed but also increases the complexity. For example: Unix, Server edition of Linux
and windows.

6. Batch Processing:

A batch processing is a group of processing system in which all the required input of
all the processing task is provided initially. The result of all the task is provided after
the completion of all the processing. Its main functions are:

1. Multiple tasks are processed


2. User cannot provide input in between the processing
3. It is appropriate only when all the inputs are known in advance
4. It requires large memory
5. CPU ideal time is less
6. Printer is the appropriate output device
7. It is old processing technique and rarely used at present

7.Online Processing:

It is an individual processing system in which the task is processed on individual basis


as soon as they are provided by the user. It has features like:

1. Individual task is processed at a time


2. User can provide input in between processing
3. It is appropriate when all inputs ate not known in advance
4. It doesn’t require large memory
5. CPU ideal time is more
6. Monitor is appropriate output device
7. It is modern processing technique and mostly used in present

Components of Operating System:


An operating system is a complex and vast system. We can only create the operating
system by dividing it into small parts. Each part must be a well-defined portion of a
system that appropriately describes the functions, inputs and outputs.
There are various operating systems that do not have a similar structure, such as
Windows, Unix, Linux, and Mac. But many operating systems use the same operating
system components such as Memory Management, Process Management, and
Input/output device Management.
There are various types of operating system components:
1. Process Management
2. File Management
3. Network Management
4. Main Memory Management
5. Secondary Storage Management
6. I/O Device Management
7. Security Management
8. Command Interpreter System
1. Process Management
The term ‘Process Management’ means a mechanism which is used to handle multiple
processes that are running in the operating system concurrently. Each software
application program contains processes that are associated with the software
application program when they are running.
For example: - If we use Google Chrome browser then a process also run for the
browser program. In the operating system, there are various processes which also run
and perform several functions.
With the help of the process management, all the processes are managed and kept
running effectively.
2. File Management
 Mapping Files onto secondary storage.
 With the help of a file management we can create and delete a file.
 It offers the facility of directory creation and deletion.
 Helps in backup files on to secondary memory.
 File and directory manipulation.
3. Network Management
We can understand from the network management that it is the process of managing
and administering the computer network. Network management comprises fault
analysis, maintaining the quality of service, provisioning of networks and performance
management.
The collection of computer / processors is known as a distributed system.
A distributed system is one which does not share its memory. In a distributed system,
each processor has its separate memory and the communication between the
processors takes place with the help of different communication lines such as
telephone lines, fiber optics etc.
In the network, with the help of the computer network, computers are connected and it
is configured in various ways. Network management provides the facility of network
connection, whether it is fully or partially connected network. And it helps to design
routing and connection strategies, which helps in overcoming the issues of security and
connection.

4. Main Memory Management


 It helps in memory allocation when a process demands or requests.
 With the help of main memory management, we can preserve track of the
primary memory.
 Main memory management also helps in memory de allocation process that no
longer need the memory or if the process is terminated.
 Main memory management is also supported in a multiprogramming system
where the operating system has to decide which process will get the memory
and how much.
 It helps to specify which part of the memory is in use and which part of the
memory is not in use.
5. Secondary Storage Management
 Secondary storage helps in Disk Scheduling.
 Storage Allocation
 Free Space Management
6. I/O Device Management
The operating system is responsible to hide the details of the hardware devices from
the user.
Functions of the I/O Management
There are various functions of I/O management:
 It offers a general device driver code.
 The I/O device management provides a buffer caching system.
 The I/O device management provides the drivers for a specific hardware device.
7. Security Management
In an operating system, there are several processes that are required to be secured from
different activities. For this purpose, there are different types of procedures we use,
which ensures that the processes that you want to operate for the hardware resources
such as memory CPU, files, etc. must have appropriate authorization from the
operating system.
For Example: With the help of the memory addressing hardware, we can ensure that a
process cannot execute outside its own address space or vice versa. Time confirms that
there is no process that has control over the CPU without leaving it.
Finally, to protect the process, there is no process that can do its own Input / Output.
And it helps to maintain the integrity of different peripheral devices.
8. Command Interpreter System
Command interpreter is an essential component of the operating system. It works as a
primary interface between the user and the system.

SYSTEM CALLS
The interface between a process and an operating system is provided by system calls.
In general, system calls are available as assembly language instructions. They are also
included in the manuals used by the assembly level programmers. 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.
A figure representing the execution of the system call is given as follows
As can be seen from this diagram, the processes execute normally in the user mode
until a system call interrupts this. Then the system call is executed on a priority basis
in the kernel mode. After the execution of the system call, the control returns to the
user mode and execution of user processes can be resumed.
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 process creation, process termination
etc.
2. File Management
These system calls are responsible for file manipulation such as creating a file, reading
a file, writing into a file etc.
3. Device Management
These system calls are responsible for device manipulation such as reading from
device buffers, writing into device buffers etc.
4. Information Maintenance
These system calls handle information and its transfer between the operating system
and the user program.
5. Communication
These system calls are useful for inter process communication. They also deal with
creating and deleting a communication connection.
Some of the examples of all the above types of system calls in Windows and Unix are
given as follows

Types of
Windows Linux
System Calls

CreateProcess() fork()
Process
ExitProcess() exit()
Control
WaitForSingleObject() wait()

CreateFile() open()
File ReadFile read()
Management ()WriteFile() write()c
CloseHandle() lose()

SetConsoleMode() ioctl()
Device
ReadConsole() read()
Management
WriteConsole() write()

GetCurrentProcessID() getpid()
Information
SetTimer() alarm()
Maintenance
Sleep() sleep()

CreatePipe() pipe()
Communicatio
CreateFileMapping() shmget()
n
MapViewOfFile() mmap()

open()
The open() system call is used to provide access to a file in a file system. This system
call allocates resources to the file and provides a handle that the process uses to refer to
the file. A file can be opened by multiple processes at the same time or be restricted to
one process. It all depends on the file organization and file system.
read()
The read() system call is used to access data from a file that is stored in the file system.
The file to read can be identified by its file descriptor and it should be opened using
open() before it can be read. In general, the read() system calls takes three arguments
i.e. the file descriptor, buffer which stores read data and number of bytes to be read
from the file.
write()
The write() system calls writes the data from a user buffer into a device such as a file.
This system call is one of the ways to output data from a program. In general, the write
system calls takes three arguments i.e. file descriptor, pointer to the buffer where data
is stored and number of bytes to write from the buffer.
close()
The close() system call is used to terminate access to a file system. Using this system
call means that the file is no longer required by the program and so the buffers are
flushed, the file metadata is updated and the file resources are de-allocated.

SYSTEM PROGRAMS
In an operating system a user is able to use different types of system programs and the
system program is responsible for all the application software performance of the
computer.
The system programs are responsible for the development and execution of a program
and they can be used by the help of system calls because system calls define different
types of system programs for different tasks.
 File management − These programs create, delete, copy, rename, print, exit and
generally manipulate the files and directory.
 Status information − It is the information regarding input, output process,
storage and the CPU utilization time how the process will be calculated in how
much memory required to perform a task is known by status information.
 Programming language supports − compiler, assembler, interrupter are
programming language support used in the operating system for a particular
purpose in the computer.
 Program Loading and execution − The needs to enter the program and after the
loading of a program it needs to execute the output of the programs and this task
is also performed by system calls by the help of system programs.
 Communication − These services are provided by the user because by using this
number of devices communicates with each other by the help of device or
wireless and communication is necessary for the operating system.
 Background services − There are different types of services available on the
operating system for communication and background service is used to change
the background of your window and it also works for scanning and detecting
viruses in the computer.
Operating System Design:
It is quite complicated to define all the goals and specifications of the operating system
while designing it. The design changes depending on the type of the operating system
i.e., if it is batch system, time shared system, single user system, multi user system,
distributed system etc.
There are basically two types of goals while designing an operating system. These are
User Goals
The operating system should be convenient, easy to use, reliable, safe and fast
according to the users. However, these specifications are not very useful as there is no
set method to achieve these goals.
System Goals
The operating system should be easy to design, implement and maintain. These are
specifications required by those who create, maintain and operate the operating
system. But there is not specific method to achieve these goals as well.
Operating System Mechanisms and Policies
There is no specific way to design an operating system as it is a highly creative task.
However, there are general software principles that are applicable to all operating
systems.
A subtle difference between mechanism and policy is that mechanism shows how to
do something and policy shows what to do. Policies may change over time and this
would lead to changes in mechanism. So, it is better to have a general mechanism that
would require few changes even when a policy change occurs.
For example - If the mechanism and policy are independent, then few changes are
required in mechanism if policy changes. If a policy favours I/O intensive processes
over CPU intensive processes, then a policy change to preference of CPU intensive
processes will not change the mechanism.
Operating System Implementation
The operating system needs to be implemented after it is designed. Earlier they were
written in assembly language but now higher level languages are used. The first system
not written in assembly language was the Master Control Program (MCP) for
Burroughs Computers.
Advantages of Higher Level Language
There are multiple advantages to implementing an operating system using a higher
level language such as: the code is written more fast, it is compact and also easier to
debug and understand. Also, the operating system can be easily moved from one
hardware to another if it is written in a high level language.
Disadvantages of Higher Level Language
Using high level language for implementing an operating system leads to a loss in
speed and increase in storage requirements. However in modern systems only a small
amount of code is needed for high performance, such as the CPU scheduler and
memory manager. Also, the bottleneck routines in the system can be replaced by
assembly language equivalents if required.

INTRODUCTION TO PROCESS
Process:
The Program in execution is called as Process. The execution of a process must
progress in a sequential fashion.
When we execute this program, it becomes a process which performs all the
tasks mentioned in the program.
When a program is loaded into the memory and it becomes a process, it can be
divided into four sections ─ stack, heap, text and data. The following image shows a
simplified layout of a process inside main memory.

S.N. Component & Description

1 Stack
The process Stack contains the temporary data such as method/function
parameters, return address and local variables.

2 Heap
This is dynamically allocated memory to a process during its run time.

3 Text
This includes the current activity represented by the value of Program
Counter and the contents of the processor's registers.

4 Data
This section contains the global and static variables.

Process Life Cycle

When a process executes, it passes through different states. These stages may differ in
different operating systems. In general, a process can have one of the following five
states at a time.

S.N State & Description


.

1 Start
This is the initial state when a process is first started / created.

2 Ready
The process is waiting to be assigned to a processor. Ready processes are waiting to
have the processor allocated to them by the operating system so that they can run.
Process may come into this state after Start state or while running it by but
interrupted by the scheduler to assign CPU to some other process.

3 Running
Once the process has been assigned to a processor by the OS scheduler, the process
state is set to running and the processor executes its instructions.

4 Waiting
Process moves into the waiting state if it needs to wait for a resource, such as waiting
for user input, or waiting for a file to become available.

5 Terminated or Exit
Once the process finishes its execution, or it is terminated by the operating system, it
is moved to the terminated state where it waits to be removed from main memory.

Process Control Block (PCB)

A Process Control Block is a data structure maintained by the Operating System for
every process. The PCB is identified by an integer process ID (PID). A PCB keeps all
the information needed to keep track of a process as listed below in the table:

S.N. Information & Description

1 Process State
The current state of the process i.e., whether it is ready, running, waiting, or
whatever.

2 Process privileges
This is required to allow/disallow access to system resources.

3 Process ID
Unique identification for each of the process in the operating system.

4 Pointer
A pointer to parent process.

5 Program Counter
Program Counter is a pointer to the address of the next instruction to be executed for
this process.

6 CPU registers
Various CPU registers where process need to be stored for execution for running
state.

7 CPU Scheduling Information


Process priority and other scheduling information which is required to schedule the
process.

8 Memory management information


This includes the information of page table, memory limits, Segment table depending
on memory used by the operating system.

9 Accounting information
This includes the amount of CPU used for process execution, time limits, execution
ID etc.

10 IO status information
This includes a list of I/O devices allocated to the process.

The architecture of a PCB is completely dependent on Operating System and may


contain different information in different operating systems. Here is a simplified
diagram of a PCB.
The PCB is maintained for a process throughout its lifetime, and is deleted once the
process terminates.
PROCESS SCHEDULING

Definition

The process scheduling is the activity of the process manager that handles the
removal of the running process from the CPU and the selection of another process on
the basis of a particular strategy.

Process scheduling is an essential part of Multiprogramming operating systems.


Such operating systems allow more than one process to be loaded into the executable
memory at a time and the loaded process shares the CPU using time multiplexing.

Process Scheduling Queues

The OS maintains all PCBs in Process Scheduling Queues. The OS maintains a


separate queue for each of the process states and PCBs of all processes in the same
execution state are placed in the same queue. When the state of a process is changed,
its PCB is unlinked from its current queue and moved to its new state queue.

The Operating System maintains the following important process scheduling queues:

 Job queue − This queue keeps all the processes in the system.

 Ready queue − This queue keeps a set of all processes residing in main
memory, ready and waiting to execute. A new process is always put in this
queue.

 Device queues − The processes which are blocked due to unavailability of an


I/O device constitute this queue.
Schedulers
Schedulers are special system software which handle process scheduling in various
ways. Their main task is to select the jobs to be submitted into the system and to
decide which process to run. Schedulers are of three types:
 Long-Term Scheduler

 Short-Term Scheduler
 Medium-Term Scheduler
Long Term Scheduler

It is also called a job scheduler. A long-term scheduler determines which


programs are admitted to the system for processing. It selects processes from the
queue and loads them into memory for execution. Process loads into the memory for
CPU scheduling.

The primary objective of the job scheduler is to provide a balanced mix of jobs,
such as I/O bound and processor bound. It also controls the degree of
multiprogramming. If the degree of multiprogramming is stable, then the average rate
of process creation must be equal to the average departure rate of processes leaving
the system.

Short Term Scheduler

It is also called as CPU scheduler. Its main objective is to increase system


performance in accordance with the chosen set of criteria. It is the change of ready
state to running state of the process. CPU scheduler selects a process among the
processes that are ready to execute and allocates CPU to one of them.

Short-term schedulers, also known as dispatchers, make the decision of which


process to execute next. Short-term schedulers are faster than long-term schedulers.

Medium Term Scheduler

Medium-term scheduling is a part of swapping. It removes the processes from


the memory. It reduces the degree of multiprogramming. The medium-term scheduler
is in-charge of handling the swapped out-processes. A running process may become
suspended if it makes an I/O request. A suspended process cannot make any progress
towards completion. In this condition, to remove the process from memory and make
space for other processes, the suspended process is moved to the secondary storage.
This process is called swapping, and the process is said to be swapped out or rolled
out. Swapping may be necessary to improve the process mix.

Context Switch

A context switch is the mechanism to store and restore the state or context of a
CPU in Process Control block so that a process execution can be resumed from the
same point at a later time. Using this technique, a context switcher enables multiple
processes to share a single CPU.

Operations on Process

The two main operations perform on Process are as follows

1. Process Creation

2. Process Termination

Process Creation

There should be four principle events which cause processes to be created.

1. System initialization
Numerous processes are created when an operating system is booted. Some of
them are

 Foreground processes − Processes that interact with users and perform work
for them.

 Background processes − It is also called as daemons and not associated with


particular users, but instead has some specific function.

2. Execution of a process-creation system call by a running process

The running process will issue system calls to create one or more new processes
to help it do its job.

3. A user request to create a new process

A new process is created with the help of an existing process executing a


process creation system call.

In UNIX, the system call which is used to create a new process is fork()

In Windows, Create Process(), which has 10 parameters to handle both process


creation and loading the correct program into the new process.

4. Initiation of a batch job

Users are going to submit batch jobs to the system.

When the operating system creates a new process and runs the next job from the
input queue in it.

Process Termination

Process is going to be terminated by a call to kill in UNIX or Terminate Process


in windows.

Process is terminated due to following reason


 Normal exit − Most processes terminate when they have completed their work
and execute a system call to exit.

 Error exit – This type of error occurs due to program bugs like executing an
illegal instruction, referencing, or dividing by zero.

 Fatal exit − A termination of a process occurs when it discovers a fatal error.

 Killed by another process − A process executes a system call to kill some


other process.

INTER PROCESS COMMUNICATION (IPC)

Process executing concurrently in the Operating system may be either


independent processes or Cooperating processes.

1. Independent Processes: They cannot affect or affected by the other


processes executing in the system.
2. Cooperating Processes: They can affect or affected by the other processes
executing in the system.

Any process that shares data with the other process is a Cooperating process.
Inter process communication comes under Cooperating processes.
Advantages of IPC

a) Information sharing
b) Computational speedup
c) Modularity
d) Convenience

Types of Inter process Communication:

1. Shared memory
2. Message Passing
1. Shared memory:
In this model, a region of memory is shared by the cooperating
processes is established.
Process can exchange information by reading and writing the data
to the shared region.
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.
Eg: Producer-Consumer problem
There are two processes: Producer and Consumer. Producer produces
some item and Consumer consumes that item. The two processes share a
common space or memory location known as a buffer where the item
produced by Producer is stored and from which the Consumer consumes
the item, if needed.
2. Message Passing:

In this method, communication takes place by message exchanged


between the cooperating processes.

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, destination) or send(message)
receive(message, host) or receive(message)
Types of Message Passing
 Synchronous and Asynchronous Message Passing
 Direct and Indirect Message Passing

Synchronous and Asynchronous Message Passing:

1. Blocking is considered as Synchronous


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.
2. Non-Blocking is considered as Asynchronous
Non-blocking send has the sender sends the message and
continue. Similarly, Non-blocking receive has the receiver
receive a valid message or null.

Direct and Indirect Message Passing:

1. Direct message passing, The process which want to communicate


must explicitly name the recipient or sender of communication.
e.g. send(p1, message) means send the message to p1.
similarly, receive(p2, message) means receive the message from p2.
2. Indirect message passing, processes use mailboxes (also referred to
as ports) for sending and receiving messages. Each mailbox has a
unique id and processes can communicate only if they share a mailbox.
Operating Systems Client/Server Communication

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:
1. 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.
A diagram that illustrates sockets is as follows −

2. Remote Procedure Calls


These are inter process 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.
A diagram that illustrates remote procedure calls is given as follows:

3. Pipes
These are Inter process 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.
A diagram that demonstrates pipes are given as follows:
Thread in OS
Thread is a sequential flow of tasks within a process. Threads in OS can be of the
same or different types. Threads are used to increase the performance of the
applications.
Each thread has its own program counter, stack, and set of registers. But the threads of
a single process might share the same code and data/file. Threads are also termed as
lightweight processes as they share common resources.
Eg: While playing a movie on a device the audio and video are controlled by different
threads in the background.

The above diagram shows the difference between a single-threaded


process and a multithreaded process and the resources that are shared among threads in
a multithreaded process.
Components of Thread
A thread has the following three components:
1. Program Counter
2. Register Set
3. Stack space
Multithreading:
In Multithreading, the idea is to divide a single process into multiple threads instead of
creating a whole new process. Multithreading is done to achieve parallelism and to
improve the performance of the applications as it is faster in many ways.

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