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

operation system notes

An operating system (OS) is a software that manages computer hardware and provides an environment for application programs, serving as an intermediary between users and hardware. It offers user interfaces, manages resources, and supports system programs while providing services like program execution, I/O operations, and security. Virtual machines and distributed operating systems enhance flexibility, resource utilization, and reliability, while system calls facilitate communication between user programs and the OS.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

operation system notes

An operating system (OS) is a software that manages computer hardware and provides an environment for application programs, serving as an intermediary between users and hardware. It offers user interfaces, manages resources, and supports system programs while providing services like program execution, I/O operations, and security. Virtual machines and distributed operating systems enhance flexibility, resource utilization, and reliability, while system calls facilitate communication between user programs and the OS.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

1.

Define Operating Systems and discuss its role from different perspectives
• An operating system is a software program that manages the computer hardware and provides an
environment for application programs to run. It acts as an intermediary between the user of a
computer and the computer hardware
• User View:
o Provides a means for user interaction with the computer system.
o Offers command-line, batch, and graphical user interfaces.
o Allows for program execution, input/output operations, file-system manipulation,
communication, and error detection.
o Single user experience
o Mainframe computers
o Workstation
o Handheld devices
• System View:
o Acts as a resource allocator and control program.
o Manages resource allocation, execution of user programs, error prevention, and control of
I/O devices.
o Resource allocator
o Control Program
• Designer's View:
o Provides a convenient and efficient environment for user program execution.
o Manages computer hardware and provides an interface for application programs and
users.

2. What are the different categories of system programs? Explain.


• System programs provide a convenient environment for program development and execution.
They can be divided into:
o File manipulation:
§ System programs that perform operations such as creating, deleting, reading, and
writing files, managing file attributes, and organizing file directories.
§ Create: System operation to generate a new file or directory in the file system.
§ Delete: System operation to remove a file or directory from the file system.
§ Rename: System operation to change the name of a file or directory.
§ Copy: System operation to duplicate a file or directory to another location.
§ Print: System operation to send the contents of a file to a printer for output.
§ List: System operation to display a directory's contents, including files and
subdirectories.
§ Manipulate file and directories: System operation to perform various actions on
files and directories, such as moving, searching, or changing permissions.
o Status information:
§ Programs that retrieve and display system-related information, such as system
configuration, resource usage, process status, and hardware details.
§ Date & time: System status information indicating the current date and time.
§ Amount of available memory or disk space: System status information detailing
the available memory or disk space.
§ Number of users: System status information indicating the count of active user
sessions or logged-in users.
§ Detailed performance: System status information providing detailed metrics on
system performance, such as CPU usage, memory utilization, and disk I/O
activity.
§ Logging and debugging information: System status information logging events,
errors, and debugging details for monitoring and troubleshooting purposes.
o File modification:
§ Programs responsible for modifying file contents or attributes, including editing
text files, renaming files, changing permissions, and setting timestamps.
o Programming language support:
§ Tools and utilities that provide support for programming languages, including
compilers, interpreters, debuggers, and development environments.
o Program loading and execution:
• Programs that load and execute other programs, managing the process of
launching applications, loading libraries, and allocating resources.
• Absolute loader: Program loading method that loads programs into
memory at fixed memory locations, typically used for simple, single-
segment programs.
• Relocatable loader: Program loading method that loads programs into
memory at any available location, adjusting memory references as
needed, allowing for more flexible memory allocation and relocation.
• Linkage editors: Programs that combine separately compiled object
modules into a single executable program, resolving symbolic references
and creating a cohesive executable.
• Overlay loaders: Program loading technique that manages memory usage
by loading program segments dynamically, swapping segments in and
out of memory as needed to conserve memory resources.
o Communications:
§ Utilities for facilitating communication between processes or systems, including
networking tools, protocols, and services for data exchange.

3. List out different services of Operating Systems and explain each service.
• User Interface:
o The user interface (UI) is the means by which users interact with a computer system or
software application. It provides a way for users to input commands, manipulate data, and
receive feedback. UIs can range from command-line interfaces (CLI) to graphical user
interfaces (GUI), touchscreens, voice recognition systems, and virtual reality
environments.
o Command-line interface (CLI): A text-based interface where users interact with the
computer system by typing commands and receiving text-based feedback.
o Batch interface: An interface where users provide a series of commands or tasks in a
script or batch file to be executed sequentially without direct user interaction.
o Graphical user interface (GUI): A visual interface that allows users to interact with the
computer system using graphical elements such as icons, windows, menus, and buttons.
• Program Execution:
o Program execution refers to the process of running software applications or programs on
a computer system. This involves loading the program into memory or compiling its
instructions and executing them sequentially or concurrently.
• I/O Operations:
o Input/output (I/O) operations involve the exchange of data between a computer system
and its external environment, including input devices (e.g., keyboards, mice), output
devices (e.g., monitors, printers), storage devices (e.g., disks, SSDs), and network
interfaces.
• File-System Manipulation:
o File-system manipulation involves creating, reading, writing, and deleting files and
directories within a file system. It includes operations such as opening files, seeking to
specific positions, reading or writing data, and managing file attributes and permissions.
o Read & Write: Operations that involve accessing and modifying the content of files or
data.
o Create & Delete: Actions for generating new files or removing existing ones from the
system.
o Search & List: Functions to locate specific files or retrieve a listing of files within a
directory.
o Permission & ownership: Control mechanisms determining who can access, modify, or
delete files, and who owns them.
• Communications:
o Communications involve the exchange of data and messages between computer systems
or devices over networks. This includes various communication protocols and
technologies such as TCP/IP, HTTP, SMTP, FTP, and Bluetooth.
o Communications may be via shared memory or through message passing (packets moved
by the OS)
o Shared memory: Communication method where multiple processes can access the same
memory region for data exchange, enabling fast and efficient communication by directly
sharing data without copying.
o Message passing: Communication method where processes exchange data through
messages, typically facilitated by the operating system, allowing processes to
communicate asynchronously and decoupling them from direct memory access.
• Error Detection:
o Error detection involves identifying and handling errors or anomalies that occur during
system operation, such as hardware failures, software bugs, data corruption, or network
issues.
o OS needs to be constantly aware of possible errors may occur in the CPU and memory
hardware, in I/O devices, in user program. For each type of error, OS should take the
appropriate action to ensure correct and consistent computing. Debugging facilities can
greatly enhance the user’s and programmer’s abilities to efficiently use the system.
• Resource allocation:
o The process of distributing and managing system resources, such as CPU time, memory,
and storage, among competing processes or users to optimize system performance and
efficiency.
o It allocates resources to each multiple programs running.
• Accounting:
o The tracking and monitoring of resource usage by processes or users, including CPU
time, memory consumption, disk I/O, and network bandwidth, for purposes such as
billing, auditing, performance analysis, and capacity planning.
o It keeps track of all resources like (used, not used, wasted)
• Protection and security:
o Measures implemented to safeguard system resources, data, and operations from
unauthorized access, misuse, modification, or destruction, ensuring confidentiality,
integrity, and availability. This includes access control mechanisms, encryption,
authentication, authorization, auditing, and intrusion detection.
o Protection involves ensuring that all access to system resources is controlled.
o Security of the system from outsiders requires user authentication, extends to defending
external I/O devices from invalid access attempts.

4. Explain the concept of virtual machines. Bring out its advantages.


• Virtual machines (VMs) are software-based emulations of physical computers that run an
operating system and applications, allowing multiple isolated instances to run concurrently on a
single physical machine.
• VMs provide a means of abstracting and partitioning hardware resources, enabling greater
flexibility, scalability, and resource utilization in computing environments.
• A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the
• operating system kernel as though they were all hardware.
• A virtual machine provides an interface identical to the underlying bare hardware. The operating
system host creates the illusion that a process has its own processor and (virtual memory). Each
guest provided with a (virtual) copy of underlying computer.

• Implementation
o VM’s software runs on kernel mode.
o VM’s itself can execute only in user mode.
o We have two modes 1) Virtual user mode 2) Virtual kernel mode.
• Advantages of virtual machines include:
o Resource Isolation: Virtual machines provide complete isolation of resources for each
virtual environment. This means that each virtual environment can run its own operating
system and applications without interference from other virtual environments.
o Flexibility: Virtual machines allow for the flexibility of running multiple operating
systems on the same physical hardware. This is useful for testing and development
purposes, as well as for running legacy applications.
o Security: Virtual machines provide a secure environment for running applications. Any
security vulnerabilities or issues within one virtual environment do not affect other virtual
environments or the underlying physical hardware.
o Disaster Recovery: Virtual machines make it easier to recover from system failures.
Snapshots and backups of virtual machines can be used to restore the system to a previous
state in case of hardware or software failures.
o Efficient Resource Utilization: Virtual machines allow for the efficient use of physical
hardware resources by running multiple virtual environments on the same hardware. This
can lead to cost savings and improved overall resource utilization.
o Simplified Maintenance: Virtualization allows for easier management and maintenance of
systems. It provides the ability to create, delete, and duplicate virtual machines, making it
easier to deploy and manage applications and services.

5. What is distributed operating system? What are the advantages of distributed operating system?
• Distributed systems are computer systems composed of multiple interconnected computers or
nodes that work together to achieve a common goal.
• In a distributed system, each node operates independently and communicates with other nodes
through a network.
• These systems can range from small-scale configurations, such as peer-to-peer networks, to large-
scale infrastructures like cloud computing platforms.
• It is used to maintain all the separate individual system through network.
• It has two modes:
o File Transfer Protocol (FTP).
o Network File System (NFS).
• Example:
o WAN.
o LAN.
o MAN.
• The advantages of distributed operating systems include:
o Resource sharing
o Computation speedup
o Reliability
o Communication
o Load sharing

6. What are system calls? Explain different categories of system calls with example?
• System calls are the interface between a user program and the operating system, providing a way
for applications to request services from the operating system kernel.
• These calls allow user-level processes to perform privileged operations, such as interacting with
hardware devices, accessing files, managing memory, and controlling system resources.
• System calls abstract the complexities of hardware and low-level software operations, providing a
standardized interface for application development across different platforms and architectures.
• Types:
o Process control:
§ Supervising the execution of processes, involving creation, termination,
scheduling, and inter-process communication, to efficiently manage system
resources and facilitate multitasking.
§ End, abort: Terminates or aborts the execution of a process, releasing associated
resources.
§ Load, execute: Loads a program into memory and executes its instructions.
§ Create process, terminate process: Initiates the creation or termination of a new
process, managing process lifecycle.
§ Get process attribute, set process attribute: Retrieves or sets attributes associated
with a process, such as its priority or permissions.
§ Wait for time: Suspends process execution for a specified duration.
§ Wait event, Single event: Pauses process execution until a specific event occurs,
either waiting for any event or a single specified event.
§ Allocate and free memory: Allocates or deallocates memory resources for a
process, managing memory usage dynamically.
o File management:
§ Overseeing the organization, creation, deletion, reading, and writing of files and
directories, ensuring structured storage and retrieval of data for users and
applications.
§ Create file, delete file: Creates or removes a file from the file system.
§ Open, Close: Establishes or terminates a file connection for reading or writing.
§ Read, Write, reposition: Reads from, writes to, or moves the file pointer within a
file.
§ Get file attribute, set file attribute: Retrieves or sets attributes associated with a
file, such as its permissions or metadata.
o Device management:
§ Managing the interaction between hardware devices and the operating system,
including device allocation, configuration, and access control, to facilitate
hardware utilization and provide abstraction for software interactions.
§ Request device, Release device: Requests or releases access to a hardware device.
§ Read, Write, Reposition: Reads from, writes to, or moves the device pointer within
a device.
§ Get device attribute, Set device attribute: Retrieves or sets attributes associated
with a device, such as its configuration or status.
§ Logically attach or detach device: Connects or disconnects a device from the
system, allowing or preventing its use by processes.
o Information maintenance:
§ Handling data storage, retrieval, and manipulation, ensuring data integrity,
consistency, and accessibility through techniques such as indexing, caching, and
backup.
§ Get time or date, set time or date: Retrieves or updates the system's current time or
date.
§ Get system data, set system data: Retrieves or updates system-wide data or
settings, such as system configuration or environment variables.
§ Get process, file, or device attributes: Retrieves attributes associated with a
process, file, or device, such as permissions, metadata, or configuration.
§ Set process, file, or device attributes: Updates attributes associated with a process,
file, or device, such as permissions, metadata, or configuration.
o Communications:
§ Facilitating data exchange and interaction between processes, users, and networked
systems through protocols, APIs, and network interfaces, enabling collaboration
and information sharing.
§ Create, delete communication channel: Establishes or terminates a channel for
communication between processes.
§ Send, receive message: Transfers data between processes through message
passing, facilitating inter-process communication.
§ Transfer status information: Exchanges status updates or information between
processes to coordinate activities or synchronize operations.
§ Attach or detach device: Connects or disconnects a device for communication,
enabling or disabling its use by processes.
o Protection: Implementing mechanisms such as access control, encryption, and
authentication to safeguard system resources, data, and operations from unauthorized
access, modification, or destruction, ensuring system integrity and security.

7. What are the 3 main purposes of an Operating System?


• Providing an environment for the execution of programs: The OS provides an environment in
which users can execute programs in a convenient and efficient manner. It manages the computer
hardware and allows users to run application programs.
• Managing the computer hardware: The OS manages the computer hardware by providing access
to resources such as CPU time, memory space, file-storage space, and I/O devices. It controls and
coordinates the use of hardware among various application programs for the various users.
• Providing services and functions to make the system more convenient for users: The OS provides
various services to users, such as user interface, program execution, I/O operations, file-system
manipulation, communication, error detection, and more. It is designed to be convenient and
efficient for the user.

8. What is the purpose of command interpreter? Why is it usually separate from the Kernel?
• The purpose of the command interpreter, also known as the shell, is to provide a user interface
that allows users to directly enter commands that are to be performed by the operating system. It
interprets the commands entered by the user and executes the next user-specified command.
• The command interpreter is usually separate from the kernel for several reasons. One reason is to
ensure system protection and security. By keeping the command interpreter separate from the
kernel, it helps in preventing unauthorized access and provides an additional layer of security for
the operating system.
• Additionally, separating the command interpreter from the kernel allows for greater flexibility and
modularity in the system. It enables the operating system to support multiple command
interpreters or shells, which can provide different functionalities and interfaces based on user
preference. Moreover, this separation allows for easier development and maintenance of the
command interpreter code, as it can be managed and updated independently of the kernel's core
functionality.
9. What is operating system? What are functions of operating system?
• An operating system is a program that manages the computer hardware and provides an
environment for application programs to run. It acts as an intermediary between the computer user
and the computer hardware, providing a means for executing programs in a convenient and
efficient manner. The functions of an operating system include:
o Process management: The operating system creates and deletes processes, provides
mechanisms for processes to communicate and synchronize with one another, and
manages the allocation of resources to processes.
o Memory management: The operating system keeps track of which parts of memory are
currently being used and by whom, decides which processes and data to move into and
out of memory, and allocates and deallocates memory space as needed.
o File system management: The operating system creates, deletes, and manipulates files and
directories, supports various file types and formats, and provides a logical view of
information storage
o I/O device management: The operating system provides a mechanism for controlling and
accessing input/output devices such as printers, storage devices, and networking devices.
o Security and protection: The operating system ensures protection and security by
controlling access to system resources and defending against external or internal attacks.
o User interface: The operating system provides a user interface, such as a command-line
interface or graphical user interface, for users to interact with the system and execute
commands.
o Resource allocation: The operating system allocates and manages resources such as CPU
time, memory space, and I/O devices among multiple users, processes, and programs
running on the system.

10. Write a brief note on different operating system structures


• Simple structure:
o Simple structure refers to an organizational design characterized by minimal levels of
hierarchy, few formal procedures, and direct lines of communication between individuals
or departments, typically found in small businesses or start-ups.
o In MS-DOS the interface and level of functionality are not well separated.
o Advantage:
§ MS-DOS was lightweight and fast, making it suitable for running on low-spec
hardware and providing quick boot times.
o Disadvantage:
§ MS-DOS lacked advanced multitasking and memory management capabilities,
limiting its ability to handle complex tasks and applications concurrently.
§ There is no dule mode and no hardware protection.

o
• Layered approach:
o Organizes the operating system into distinct layers, with each layer providing a specific
set of services to the layers above while relying on services from the layers below,
facilitating modular design and abstraction of complexity.
o The operating system is divided into several layers (levels), each built on top of lower
layers. The bottom layer (layer 0) is the hardware; the highest (layer N) is the user
interface. With modularity, layers are selected such that each uses functions (operations)
and services of only lower level layer.
o Advantage:
§ The layered approach simplifies system design and maintenance by promoting
modularity and encapsulation, allowing for easier debugging, testing, and
modification of individual components.
o Disadvantage:
§ Overhead may occur due to the need for communication between layers,
potentially impacting system performance and efficiency.

o
• Microkernel
o Microkernels are operating system kernels that provide only essential services, such as
inter-process communication and memory management, while moving non-essential
functions, like device drivers and file systems, into user space.
o This design promotes simplicity, reliability, and extensibility by minimizing the size and
complexity of the kernel, allowing for easier customization and maintenance.
o Advantage:
§ Microkernels offer increased reliability and security since critical services run in
user space, reducing the likelihood of system crashes and vulnerabilities in
privileged kernel code.
o Disadvantage:
§ ]The performance overhead incurred by inter-process communication between user
space and kernel space can lead to reduced system performance compared to
monolithic kernels.

o
• Traditional UNIX System Structure
o Organizes the operating system into a monolithic kernel architecture where all kernel
services are implemented within a single address space.
o Advantage:
§ Monolithic kernels typically offer high performance due to direct access to system
resources and minimized overhead from inter-process communication.
o Disadvantage:
§ Monolithic kernels can be less modular and harder to maintain, as changes to one
component may require recompilation or modification of the entire kernel.
• Module
o A self-contained software component that encapsulates specific functionality and can be
integrated into a larger system, typically offering well-defined interfaces for interaction.
o Most modern operating systems implement kernel modules.
o Uses object-oriented approach.
o Each core component is separate.
o Each talk to the others over known interfaces.
o Each is loadable as needed within the kernel.
o Overall, like layers but with more flexible.
o Advantage:
§ Modules promote code reuse, maintainability, and extensibility by allowing
developers to isolate and independently develop, test, and update individual
components.
o
o Disadvantage:
§ Overuse or excessive modularity can lead to increased complexity and overhead,
making the system harder to understand, debug, and maintain.

11. Explain the 'graceful degradation' and 'fault tolerant' in a multiprocessor system.
• Graceful Degradation:
o Refers to a computer system's ability to continue providing service proportionately to the
level of surviving hardware.
o In multiprocessor systems, it means that if one processor fails, the entire system will only
slow down.
o This is achieved by distributing functions among several processors.
• Fault Tolerance:
o Involves the ability of a system to suffer a single component failure and continue
operation.
o It requires a mechanism to detect, diagnose, and potentially correct the failure.
o Examples include the HP Non-Stop system, which uses hardware and software
duplication to ensure continued operation despite faults.

12. Explain computer system architecture?


• Computer system architecture refers to the conceptual design and structural organization of a
computer system. It encompasses the arrangement and interaction of hardware components,
software systems, and communication pathways within the system.
• This architecture defines the fundamental principles, guidelines, and standards that govern the
construction, operation, and evolution of the computer system.
• Most systems use a single general-purpose processor (PDAs through mainframes) and have
special-purpose processors as well.
• Multiprocessors systems growing in use and importance also known as parallel systems, tightly-
coupled systems
• Single-process system:
o In a single-process system, only one program or process can execute at any given time.
This type of system is typically found in simple embedded systems or early computing
environments.
• Multi-process system:
o In a multi-process system, multiple programs or processes can execute concurrently. This
type of system is commonly found in modern operating systems like Linux, Windows,
and macOS.
o Advantages:
§ Fault tolerant
§ Increased throughput
§ Economy of scale
§ Increased reliability
§ Graceful degradation
• Clustered systems:
o These are different from multiprocessor systems, they are composed of two or more
individual systems coupled together.
o There are two types.
§ Asymmetric Multiprocessing: In asymmetric multiprocessing, a single master
processor controls the system, while subordinate processors perform predefined
tasks assigned by the master.
§ Symmetric Multiprocessing: In symmetric multiprocessing, all processors have
equal access to system resources and can execute tasks independently, enabling
parallel processing and improved performance.

13. Describe differences between symmetric and asymmetric multiprocessing. What are three
advantages and one disadvantage of multiprocessor systems?
• Symmetric multiprocessing (SMP) and asymmetric multiprocessing are two types of multiple-
processor systems. In asymmetric multiprocessing, each processor is assigned a specific task, and
a master processor controls the system. The other processors either look to the master for
instruction or have predefined tasks. This creates a master-slave relationship. On the other hand,
symmetric multiprocessing (SMP) allows each processor to perform all tasks within the operating
system. In SMP, all processors are peers, and there is no master-slave relationship between
processors.
• Three advantages of multiprocessor systems are:
o Increased Throughput: By increasing the number of processors, more work can be done in
less time.
o Economy of Scale: Multiprocessor systems can cost less than equivalent multiple single
processor systems because they can share peripherals, mass storage, and power supplies.
o Increased Reliability: If functions can be distributed properly among several processors,
then the failure of one processor will not halt the system, only slow it down. This
increased reliability is crucial in many applications.
• One disadvantage of multiprocessor systems is that the speed-up ratio with N processors is not N.
It is less than N. When multiple processors cooperate on a task, a certain amount of overhead is
incurred in keeping all the parts working correctly.
• Overhead, plus contention for shared resources, lowers the expected gain from additional
processors. Similarly, N programmers working closely together do not produce N times the
amount of work a single programmer would produce.

14. Discuss the Simple Operating System Structure. Describe the layered approach
• Simple structure:
o Simple structure refers to an organizational design characterized by minimal levels of
hierarchy, few formal procedures, and direct lines of communication between individuals
or departments, typically found in small businesses or start-ups.
o In MS-DOS the interface and level of functionality are not well separated.
o Advantage:
§ MS-DOS was lightweight and fast, making it suitable for running on low-spec
hardware and providing quick boot times.
o Disadvantage:
§ MS-DOS lacked advanced multitasking and memory management capabilities,
limiting its ability to handle complex tasks and applications concurrently.
§ There is no dule mode and no hardware protection.
o
• Layered approach:
o Organizes the operating system into distinct layers, with each layer providing a specific
set of services to the layers above while relying on services from the layers below,
facilitating modular design and abstraction of complexity.
o The operating system is divided into several layers (levels), each built on top of lower
layers. The bottom layer (layer 0) is the hardware; the highest (layer N) is the user
interface. With modularity, layers are selected such that each uses functions (operations)
and services of only lower level layer.
o Advantage:
§ The layered approach simplifies system design and maintenance by promoting
modularity and encapsulation, allowing for easier debugging, testing, and
modification of individual components.
o Disadvantage:
§ Overhead may occur due to the need for communication between layers,
potentially impacting system performance and efficiency.

15. Explain operating system functions and services in detail. (Same as 3rd)

16. Discuss the operation of process creation and process termination in UNIX.
• In UNIX, process creation is initiated by the long-term scheduling, where processes contend for
the CPU. Once a process is selected, the short-term scheduling kicks in and selects a process from
the ready queue to execute. The new process is then created by the fork() system call, which
creates a new process with an identical copy of the parent process's PCB and code segment. The
child process has its own stack, data, and heap segments. Once the process is created, it is added
to the ready queue and can begin execution.
• When a process is done executing, it performs an exit() system call to terminate. The termination
process involves the release of all the resources associated with the process, such as memory,
open files, and I/O buffers. The termination may be initiated by the process itself, by encountering
an error or completing its execution, or it may be initiated by a parent process, such as when a
child process is no longer needed. The termination involves handling any allocated resources and
returning the status code to the parent process.
• In addition to the standard system calls for process creation and termination, UNIX also provides
mechanisms for Interprocess communication, such as shared memory and message passing, which
allow processes to exchange information. These communication mechanisms are crucial for
processes to cooperate and work together effectively. Overall, the operation of process creation
and termination in UNIX involves a combination of system calls, scheduling algorithms, and
resource management to ensure the efficient execution and termination of processes.

17. Explain the dual mode operation of an operating system, with neat diagram.
• Dual mode operation in an operating system refers to its ability to differentiate between executing
operating system code and user-defined code.
• Most computer systems use hardware support to distinguish between two modes of execution:
user mode and kernel mode.
• A mode bit is added to the computer's hardware, indicating the current mode as either kernel (0)
or user (1).
• When a computer system executes a user application, it operates in user mode.
• However, when a user application requires a service from the operating system through a system
call, the system transitions from user mode to kernel mode to fulfil the request.
• By invoking a system call, the user-level program switches the system from user mode to kernel
mode, allowing the operating system to provide the requested service.
• Once the service is complete, control is returned to the user application, and the system switches
back to user mode.
• In kernel mode, the CPU has unrestricted access to the computer's underlying hardware, including
memory and I/O devices.
• This mode is intended for executing trusted operating system code and handling system-level
operations.
• Conversely, in user mode, the CPU's access to hardware is limited, with restricted access to
memory and I/O devices.
• This mode is designed for executing user applications while preventing interference with critical
operating system functions.
• The dual mode operation safeguards the operating system from unauthorized users or
applications.
• Any attempt to execute privileged instructions in user mode will result in a trap to the operating
system, ensuring protection.

18. What is Multithreaded process? Discuss the benefits of multithreaded programming.


• A multithreaded process is a program that contains multiple threads of execution. Each thread
within the program can perform a specific task concurrently with other threads within the same
address space.
• The benefits of multithreaded programming can be broken down into four major categories:
o Responsiveness: Multithreading an interactive application allows the program to continue
running even if part of it is blocked or is performing a lengthy operation, thereby
increasing responsiveness to the user. For example, a multithreaded web browser could
still allow user interaction in one thread while an image was being loaded in another
thread.
o Resource sharing: Threads share the memory and resources of the process to which they
belong. This allows an application to have several different threads of activity within the
same address space.
o Economy: Allocating resources for process creation is costly. Because threads share
resources of the process to which they belong, it is more economical to create and
context-switch threads. In general, it is much more time-consuming to create and manage
processes than threads.
o Utilization of multiprocessor architectures: The benefits of multithreading can be greatly
increased in a multiprocessor architecture, where threads may be running in parallel on
different processors. A single-threaded process can only run on one CPU, no matter how
many are available. Multithreading on a multi-CPU machine increases concurrency.
19. Explain the distinguishing features of i). Real time system ii) Multiprocessor system

20. What do you mean by cooperating process? Describe its four advantages.
• Interprocess communication (IPC) refers to the mechanisms and techniques used by processes to
exchange data, synchronize their actions, and communicate with each other within a computing
environment.
• IPC allows processes running concurrently on the same system to interact, share information, and
coordinate their activities, facilitating collaboration and enabling complex tasks to be performed
efficiently.
• Process executing concurrently in the OS may be either independent process or cooperating
process.
• There are several reasons for providing an environment that allows process cooperation:
o Informationsharing:IPCfacilitatestheexchangeofdataandresourcesbetween processes,
enabling collaboration and coordination.
o Computationalspeed:IPCmechanismscanenhanceperformancebyallowingprocesses to
execute concurrently and distribute computation tasks.
o Modularity:IPCsupportsmodulardesignbyenablingprocessestobedevelopedand
maintained independently, promoting scalability and code reusability.
o Convenience:IPCprovidesconvenientmeansforprocessestocommunicateand synchronize
their actions, simplifying complex system interactions and interdependencies.

You might also like