Presentation 9
Presentation 9
b) Multitasking Systems:-
Multitasking is an extension of multiprogramming that provides multiple tasks (processes or threads) the appearance of
running concurrently. It involves switching the CPU between tasks rapidly to give the illusion of parallel execution.
Architecture:
Task Scheduling: Multitasking involves scheduling tasks in a way that each task gets a share of CPU time. This can be achieved through techniques
like time slicing, where each task is given a small time quantum to execute before switching to the next task.
Context Switching: The operating system must save the state of a task when switching to another task and then restore that state when switching
back. This process is called context switching. Efficient context switching is crucial for the smooth operation of multitasking systems.
User Interface Responsiveness: Multitasking is often associated with graphical user interfaces (GUIs), where multiple applications or processes
can run concurrently, and users can switch between them seamlessly.
c) Multiprocessor Systems:-
A multiprocessor system is an operating system architecture that involves multiple processors (or CPUs) working together to
execute tasks. This is also known as parallel processing.
Architecture:
Symmetric Multiprocessing (SMP): In SMP systems, all processors are treated equally and have equal access to the main memory. The operating
system divides the tasks among the processors, and each processor executes its portion of the task concurrently.
Asymmetric Multiprocessing (AMP): In AMP systems, one processor (the master) controls the system, and the other processors (slaves) perform
specific tasks assigned by the master. The master processor is responsible for overall system management.
Load Balancing: In multiprocessor systems, load balancing is crucial to ensure that tasks are distributed evenly among processors. This helps in
achieving better performance and utilization of system resources.
Fault Tolerance: Multiprocessor systems can be designed to be fault-tolerant. If one processor fails, the tasks assigned to that processor can be
rerouted to other processors, ensuring continued operation.
• Question no : 3
Ans). Process Control Block (PCB):-
A Process Control Block (PCB), also known as a Task Control Block or Task Descriptor, is a data structure in the operating system kernel that contains
information about a specific process. The PCB is created and maintained by the operating system to manage each individual process. It serves as a
central repository of information related to the state of a process and facilitates the operating system's ability to control and manage processes
effectively.
Usage: The PCB is used in the context of process management within an operating system. It is created when a process is first initiated and is updated
throughout the lifetime of the process. The operating system uses the PCB to keep track of various attributes and states of a process, allowing for
efficient scheduling, resource management, and context switching.
Contents of PCB: The contents of a PCB may vary slightly based on the operating system, but typically, it includes the following information:
1. Process ID (PID): A unique identifier for the process.
2. Program Counter (PC): The address of the next instruction to be executed.
3. Processor Registers: Contents of various processor registers.
4. CPU Scheduling Information: Information about the process's priority, scheduling state, etc.
5. Memory Management Information: Information about the process's memory allocation, such as page tables or segment tables.
6. I/O Status Information: The status of open files, I/O devices in use, etc.
7. Accounting Information: Resource usage statistics like CPU time, clock time, etc.
8. Process State: The current state of the process (running, ready, blocked, etc.).
• Question no : 4
Ans). System Calls:-
A system call is a programming interface provided by the operating system to allow applications to request services from the operating system's kernel.
These services include low-level operations such as input/output operations, process control, file management, memory allocation, and communication between processes.
System calls provide a bridge between user-level programs and the kernel, enabling user programs to interact with hardware and other system resources.
Categories of System Calls:-
o Process Control:
• fork(): Create a new process.
• exit(): Terminate the calling process.
• wait(): Wait for the child process to terminate.
o File Management:
• open(): Open a file.
• read(): Read data from a file.
• write(): Write data to a file.
o Device Management:
• ioctl(): Control device parameters.
• read(): Read data from a device.
• write(): Write data to a device.
o Information Maintenance:
• getpid(): Get the process ID of the calling process.
• time(): Get the current time.
o Communication:
• pipe(): Create an inter-process communication channel.
• shmget(): Get a shared memory segment.
o Memory Management:
• brk(): Change the data segment size.
• mmap(): Map files or devices into memory.
• Question no : 5
Ans). Dual-Mode Operation in Operating Systems:-
• Concept: Dual-mode operation, also known as dual privilege or dual-ring architecture, is a feature in modern operating systems designed to
enhance the security and stability of the system. It involves two distinct privilege levels or modes of operation: User Mode and Kernel Mode (also
known as Supervisor Mode, System Mode, or Privileged Mode).
o Modes of Operation:-
User Mode:
In this mode, applications and user-level processes run with restricted access to system resources. User mode provides a protective barrier to prevent
user programs from directly accessing critical hardware and system resources.
Kernel Mode:
Kernel mode is a privileged mode that allows the operating system's kernel to have unrestricted access to the entire system. In this mode, the
operating system can execute privileged instructions and access sensitive hardware resources.
o Enhancing Security and Stability:-
Security:
User programs run in User Mode, limiting their ability to directly manipulate or access system resources. Unauthorized access to critical system
components is restricted. Only the operating system's kernel, running in Kernel Mode, has the authority to execute privileged instructions and control
hardware resources.
Stability:
Separating user-level processes from the kernel helps prevent unintentional or malicious interference with critical system components. In the event of
a fault or error in a user program, the impact is confined to the user mode, minimizing the risk of crashing the entire system.
Example: Consider a scenario where a user program attempts to write data directly to a specific memory location.
In a Dual-Mode architecture:
User Mode Operation: The user program runs in User Mode, and any attempt to write directly to a protected memory location will result in a privilege
violation or exception.
Kernel Mode Operation: The operating system's kernel, running in Kernel Mode, is responsible for handling memory management and ensuring the
integrity of the system. When a user program needs to write data to a specific memory location, it makes a system call. The transition to Kernel Mode
occurs to execute the privileged operation.
o Transition between Modes:-
Mode Switching:
A mode switch occurs when transitioning from User Mode to Kernel Mode . System calls or exceptions trigger a mode switch. For example, when a
user program invokes a system call, it transitions to Kernel Mode to allow the operating system to perform the requested operation.
Controlled Transition:
The transition between modes is controlled by hardware mechanisms, such as the processor's interrupt and trap mechanisms. The operating system
decides when to allow user programs to execute privileged operations, ensuring controlled access to sensitive resources.