6/6/2023
OPERATING SYSTEM
SUPPORT
3 Hours
4 Marks (Approx.)
OUTLINES
• 3.1 The operating system layer
• 3.2 Protection
• 3.3 Process and threads
• 3.4 Communication and invocation
• 3.5 Operating system architecture
Prepared By: Er. Bibat Thokar 1
6/6/2023
OPERATING SYSTEM – [1]
• An Operating System (OS) is an interface between a computer user and computer
hardware.
• 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, VMS, OS/400, AIX, z/OS, etc.
OPERATING SYSTEM – [2]
Prepared By: Er. Bibat Thokar 2
6/6/2023
OPERATING SYSTEM LAYER – [1]
• The OS layer is present below the middleware layer.
• OS provides problem-oriented abstractions of the underlying physical resources.
• Middleware is responsible to provide proper utilization of local resources to implement
mechanisms for remote invocations between objects or processes at the nodes.
• Kernel and server processes are responsible to manage resources and present clients
with an interface to the resources.
• Kernel, as a resource manager, must provide encapsulation, protection and concurrent
processing.
• Clients access resources by making invocations to a server object or system calls to a
kernel.
OPERATING SYSTEM LAYER – [2]
• Figure shows how the OS layer at each of the two nodes supports a common
middleware layer in providing a distributed infrastructure for applications and services.
• Kernels and server processes are the components that manage resources and present
clients with an interface to the resources
Prepared By: Er. Bibat Thokar 3
6/6/2023
CORE OS FUNCTIONALITY – [1]
• Process Manager
• As a process manager, OS handles the creation of processes and the operations
upon them.
• Thread Manager:
• As a thread manager, OS is responsible for thread creation, synchronization and
scheduling.
• Communication Manager
• OS is responsible for communication between threads attached to different
processes on same computer or in remote processes.
• In some OS, additional service is necessary for communication.
CORE OS FUNCTIONALITY – [2]
• Memory Manager
• OS also deals with management
of physical and virtual memory
to ensure efficient data sharing.
• Supervisor
• OS is responsible to dispatch
interrupts, system call traps,
memory management control,
and hardware cache and so on.
Prepared By: Er. Bibat Thokar 4
6/6/2023
PROCESS
• Process is defined as an entity which represents the basic unit of work to be
implemented in the system
• i.e. a process is a program in execution i.e. an instance of a running program
• Execution of a process must progress in a sequential fashion.
• Process will need certain resources such as the CPU time, memory, files, I/O devices
and etc. to accomplish its task.
• When a program is executed, the operating system creates a process to manage and
track its execution
• Each process is assigned a unique process identifier (PId) that distinguishes it from
other processes running on the system.
Prepared By: Er. Bibat Thokar 9
PROCESS STATE (FIVE STATE MODEL) – [1]
10
Prepared By: Er. Bibat Thokar
Prepared By: Er. Bibat Thokar 5
6/6/2023
PROCESS STATE (FIVE STATE MODEL) – [2]
• New
• A process that has just been created but has not yet been admitted to the pool of
executable processes by the OS.
• Ready
• Process that is prepared to execute when given the opportunity. i.e. they are not
waiting on anything except the CPU availability.
• Running
• The process that is currently being executed.
Prepared By: Er. Bibat Thokar 11
PROCESS STATE (FIVE STATE MODEL) – [3]
• Blocked
• A process that cannot execute until some event occurs, such as the completion of
an I/O operation.
• Exit
• A process that has been released from the pool of executable processes by the OS,
either because it is halted or because it is aborted for some reason
• A process that has been released by OS either after normal termination or after
abnormal termination (error).
Prepared By: Er. Bibat Thokar 12
Prepared By: Er. Bibat Thokar 6
6/6/2023
PROCESS CONTROL BLOCK - [1]
• A process control block or PCB is a data structure (a table) that
holds information about a processes.
• Every process or program that runs needs a PCB.
• When a user requests to run a particular program, the operating
system constructs a process control block for that program.
• It is also known as Task Control Block (TCB).
• PCB contains many pieces of information associated with a
specific process.
• i.e. it simply serves as the repository for any information that
may vary from process to process.
Prepared By: Er. Bibat Thokar 13
PROCESS CONTROL BLOCK – [2]
• Process State
• State may be new, ready, running, and waiting, halted, and so on.
• Program Counter (PC)
• Counter indicates the address of the next instruction to be executed for this process.
• CPU register
• Registers vary in number and type, depending on the computer architecture.
• Includes accumulator, index registers, stack pointers, and general-purpose registers.
• Along with the program counter, this state information must be saved when an
interrupt occurs, to allow the process to be continued correctly afterward.
Prepared By: Er. Bibat Thokar 14
Prepared By: Er. Bibat Thokar 7
6/6/2023
PROCESS CONTROL BLOCK – [3]
• CPU Scheduling information
• Includes a process priority, pointers to scheduling queues, and other scheduling
parameters.
• Memory management information
• Includes the value of the base and limit registers, the page table, or the segment
tables, depending on the memory system used by the OS.
• Accounting information
• Includes the amount of CPU and real time used, time limits, account numbers, job or
process numbers and so on.
• I/O status information
• Includes the list of I/O devices allocated to the process, a list of open files and so on.
Prepared By: Er. Bibat Thokar 15
THREAD – [1]
• Thread refers to the smallest unit of execution within a process.
• Also sometimes called a lightweight process.
• Process can be seen as an instance of a running program, while a thread represents a
single sequence of instructions within that process
• Process can have multiple threads, and these threads can execute concurrently,
allowing for parallelism and increased utilization of system resources.
• Threads within the same process share the same memory space, file descriptors, and
other process-related resources.
• Can communicate and synchronize with each other more efficiently than processes,
which typically require inter-process communication mechanisms like pipes or shared
memory.
Prepared By: Er. Bibat Thokar 8
6/6/2023
THREAD – [2]
• Commonly used to achieve concurrent execution of multiple tasks within a program
• For example, a web server may create a separate thread for each incoming client
request, allowing multiple clients to be served simultaneously.
• Threads can be implemented either at the user level (user threads) or within the kernel
(kernel threads)
• User threads are managed by a user-level thread library and are invisible to the kernel.
• Kernel threads are supported and scheduled directly by the operating system kernel.
• Operating systems provide thread management facilities, including thread creation,
termination, synchronization, and communication mechanisms
THREADS – [3]
Figure: Process with Single Thread Figure: Process with Multiple Thread
Prepared By: Er. Bibat Thokar 18
Prepared By: Er. Bibat Thokar 9
6/6/2023
PROTECTION MECHANISM – [1]
• Refer to a set of techniques and controls implemented to ensure the security, integrity,
and privacy of system resources and user data
• Help prevent unauthorized access, accidental or intentional misuse, and interference
between different processes or users
• Access Control
• Determine who can access specific system resources, such as files, directories, or
devices
• Access control lists (ACLs) or permissions define the privileges granted to users or
groups, allowing or denying actions like reading, writing, executing, or modifying
resources.
PROTECTION MECHANISM – [2]
• User Authentication
• Verifies the identity of users before granting access to the system
• Involves username/password combinations, biometric authentication, smart cards,
or other mechanisms to ensure that users are who they claim to be.
• Encryption
• Used to protect data confidentiality by converting information into unreadable form
• Encrypted data can only be deciphered with the appropriate decryption key,
ensuring that sensitive data remains secure, even if it is intercepted or accessed by
unauthorized individuals.
Prepared By: Er. Bibat Thokar 10
6/6/2023
PROTECTION MECHANISM – [2]
• Firewalls
• Act as a barrier between internal and external networks, controlling incoming and
outgoing network traffic based on predefined security rules
• Prevent unauthorized access and protect systems from network-based attacks
• Virtual Memory Protection
• Ensure that processes cannot access or modify memory regions that do not belong
to them
• Each process has its own virtual address space, and the operating system enforces
memory isolation and access restrictions, preventing unauthorized access or
interference between processes.
PROTECTION MECHANISM – [2]
• File Permissions
• Control access to files and directories
• Specify who can read, write, or execute files, and whether those permissions apply
to the file owner, group members, or all users on the system
• Ensure that only authorized users or processes can access or modify files.
Prepared By: Er. Bibat Thokar 11
6/6/2023
PROTECTION MECHANISM – [2]
• Process Isolation
• Prevent processes from interfering with each other or accessing each other's
memory or resources
• Each process runs in its own protected address space, ensuring that one process
cannot directly affect the execution or data of another process.
• Audit Logs
• Record system activities, such as user logins, file accesses, system configuration
changes, and other relevant events
• Help to track and investigate security incidents, identify potential vulnerabilities, and
ensure compliance with security policies and regulations
OPERATING SYSTEM ARCHITECTURE
• Monolithic Operating System
• Layered Operating System
• Microkernel Operating system
• Network Operating System
• Distributed Operating System
Prepared By: Er. Bibat Thokar 12
6/6/2023
MONOLITHIC OPERATING SYSTEM – [1]
• A monolithic operating system is a type of operating system architecture where the
entire operating system is designed as a single, large software module
• All the essential system services, such as process management, memory management,
file system management, and device drivers, are combined into a single executable
binary.
• All services run in the same address space and share the same memory space
• Communicate with each other through function calls and data structures, enabling them
to work together to provide the necessary functionalities for the computer system
• Allows for efficient and direct communication between the components of the operating
system.
MONOLITHIC OPERATING SYSTEM – [2]
Prepared By: Er. Bibat Thokar 13
6/6/2023
LAYERED OPERATING SYSTEM – [1]
• As operating systems became larger and more complex, purely monolithic designs
became unwieldy.
• The layered approach to operating systems attempts to address this issue by grouping
components that perform similar functions into layers.
• Each layer communicates exclusively with those immediately above and below it.
• Lower level layers provide services to higher-level ones using an interface that hides
their implementation.
• Example: Windows XP and Linux
LAYERED OPERATING SYSTEM – [2]
Prepared By: Er. Bibat Thokar 14
6/6/2023
MICROKERNEL OPERATING SYSTEM – [1]
• Microkernel operating system is designed to be minimalistic and modular, with a small
kernel that provides essential services like thread scheduling and communication
• Non-essential services are moved to separate user-space processes called services.
• Goal is to simplify the system, increase reliability, and allow for easier maintenance and
customization
• Mediates communication between user-level services, enforces protection boundaries,
and manages resource allocation
• Services run in isolation, so if one fails, it doesn't affect the entire system
• Reduces kernel complexity, enhances fault isolation, and improves system reliability and
extensibility. Examples: like QNX and MINIX
MICROKERNEL OPERATING SYSTEM – [2]
Prepared By: Er. Bibat Thokar 15
6/6/2023
NETWORK OPERATING SYSTEM (NOS) – [1]
• Type of operating system specifically designed to facilitate the management and
coordination of multiple computers and devices within a network
• Provides the necessary functionality to share resources, such as files, printers, and
applications, and enables communication and data exchange between networked
devices.
• Typically includes features like network file sharing, directory services, security and
access control, network administration tools, and protocols for network communication.
• Allows users to access shared resources, collaborate on files, and centrally manage
network settings and configurations.
NETWORK OPERATING SYSTEM (NOS) – [2]
• One example of a network operating system is Microsoft Windows Server
• Windows Server provides a comprehensive set of network-oriented features and
services to support enterprise-level networking environments
• Includes components such as Active Directory for user and resource management, file
and print services for sharing files and printers, and networking protocols like TCP/IP for
network communication.
• Administrators can set up user accounts, assign permissions, and manage access to
network resources
• Windows Server supports features like domain controllers, which allow centralized
management of network users and resources across multiple computers and locations.
Prepared By: Er. Bibat Thokar 16
6/6/2023
DISTRIBUTED OPERATING SYSTEM – [1]
• An operating system that runs on multiple machines and allows them to work together
as a single integrated system
• Enables the transparent sharing of resources, coordination of tasks, and communication
among the distributed components
• Goal is to provide a unified and efficient computing environment that harnesses the
power of multiple machines.
• Each machine, also known as a node or host, retains its own local operating system, but
these nodes collaborate and coordinate their activities
• Distributed nature of the system provides increased performance, fault tolerance,
scalability, and resource utilization.
DISTRIBUTED OPERATING SYSTEM – [2]
• Examples of distributed operating systems include Google's Kubernetes
• Manages and orchestrates containerized applications across a cluster of machines, and
the Distributed System Object Model (DSOM)
• Provides a framework for building distributed applications on IBM's AIX operating system
Prepared By: Er. Bibat Thokar 17
6/6/2023
DEADLOCK IN DISTRIBUTED SYSTEM – [1]
• Deadlock refers to a situation where multiple processes or nodes are unable to progress
because they are waiting for each other to release resources
• Deadlocks can occur when processes or nodes hold resources and wait for additional
resources that are being held by other processes or nodes, resulting in a circular
dependency.
• Example: Suppose we have a distributed system with three nodes, Node A, Node B, and
Node C
• Each node has a resource that the other nodes require to complete their tasks.
• Node A has Resource X, Node B has Resource Y, and Node C has Resource Z
• The processes running on each node need to acquire resources from others to proceed.
DEADLOCK IN DISTRIBUTED SYSTEM – [2]
• However, due to some synchronization issue or incorrect resource management, a
deadlock situation arises.
• Process P1 on Node A acquires Resource X.
• Process P2 on Node B acquires Resource Y.
• Process P3 on Node C acquires Resource Z.
• Now, each process needs an additional resource that is held by another process,
leading to a circular dependency:
• Process P1 on Node A needs Resource Y from Node B.
Prepared By: Er. Bibat Thokar 18
6/6/2023
DEADLOCK IN DISTRIBUTED SYSTEM – [3]
• Process P2 on Node B needs Resource Z from Node C.
• Process P3 on Node C needs Resource X from Node A.
• None of the processes can proceed as they are waiting for resources held by other
processes, resulting in a deadlock
• In this state, none of the processes can complete their tasks, and the system becomes
unresponsive
DEADLOCK IN DISTRIBUTED SYSTEM – [4]
• Coffman defined four conditions that have to be met for a deadlock to occur in a system
• Mutual exclusion
• To deny this means that we will allow a resource to be held (used) by more than one
process at a time
• If a resource can be shared then there is no need for mutual exclusion and deadlock
cannot occur
• Hold and wait
• Denying this means that processes that hold resources cannot wait for another
resource
• It typically implies that a process should grab all of its resources at once
Prepared By: Er. Bibat Thokar 19
6/6/2023
DEADLOCK IN DISTRIBUTED SYSTEM – [5]
• Non-preemption
• A resource, once granted, cannot be taken away
• In transactional systems, allowing preemption means that a transaction can come in
and modify data (the resource) that is being used by another transaction
• Circular wait
• Avoiding circular wait means that we ensure that a cycle of waiting on resources
does not occur
• We can do this by enforcing an ordering on granting resources and aborting
transactions or denying requests if an ordering cannot be granted
DEADLOCK DETECTION
• There are three approaches to detect deadlocks in distributed systems as:
• Centralized approach
• Distributed approach
• Hierarchical approach
Prepared By: Er. Bibat Thokar 20
6/6/2023
CENTRALIZED APPROACH
• In the centralized approach, there is only one responsible resource to detect deadlock
• The advantage of this approach is that it is simple and easy to implement
• The drawbacks include excessive workload at one node, single-point failure i.e. the
whole system is dependent on one node if that node fails the whole system crashes
DISTRIBUTED APPROACH
• In the distributed approach different nodes work together to detect deadlocks
• No single point failure i.e. the whole system is dependent on one node if that node fails
the whole system crashes as the workload is equally divided among all nodes
• The speed of deadlock detection also increases
Prepared By: Er. Bibat Thokar 21
6/6/2023
HIERARCHICAL APPROACH
• It is the combination of both centralized and distributed approaches of deadlock
detection in a distributed system
• In this approach, some selected nodes or clusters of nodes are responsible for deadlock
detection and these selected nodes are controlled by a single node
COMMUNICATION AND INVOCATION
• Communication and invocation facilitate the interaction between different processes or
components within an operating system
• Communication in operating system support involves the exchange of information, data,
or signals between processes or components running within the operating system
• Invocation in operating system support refers to the mechanism through which
processes or components request services or actions from the operating system or other
processes.
• It involves initiating a call to a specific system function or routine to perform a particular
task. Invocation can occur in different ways:
Prepared By: Er. Bibat Thokar 22
6/6/2023
COMMUNICATION
• Inter-process Communication (IPC)
• There are several mechanisms for IPC, such as shared memory, message passing,
pipes, and sockets
• These mechanisms allow processes to communicate and coordinate their activities,
facilitating tasks like data sharing, coordination, and cooperation between
processes.
• Synchronization
• Operating systems provide synchronization mechanisms to coordinate access to
shared resources or ensure orderly execution of concurrent processes
• Locks, semaphores, and condition variables are commonly used to synchronize
access to critical sections of code or shared resources, preventing race conditions
and ensuring consistency
INVOCATION
• System Calls
• Allow processes to request privileged services, such as file operations, process
management, network communication, and device access
• When a process wants to perform a system-specific operation, corresponding
system transferred to the operating system kernel to handle the requested service
• Remote Procedure Calls (RPC)
• RPC is a mechanism that enables processes running on different systems to invoke
procedures or functions residing on remote systems
• It abstracts the invocation process, allowing processes to call procedures on remote
machines as if they were local
• Handles the communication details transparently, making remote invocation appear
similar to local invocation.
Prepared By: Er. Bibat Thokar 23
6/6/2023
END OF THE CHAPTER
ASSIGNMENT-3
• Solve the questions from ‘old questions collection’ starting from 2079
Bhadra to 2068 Magh related to chapter-3.
• You may avoid repeated questions
• Submit the assignment within 10 days.
• Please refer reference books prescribed by syllabus of IOE.
• Remember: Assignments contains 20 % overall internal marks!!!
• No copy paste, no skip of questions!!!
Prepared By: Er. Bibat Thokar 48
Prepared By: Er. Bibat Thokar 24
6/6/2023
THANK YOU
Prepared By: Er. Bibat Thokar 25