Operating System Basics
Operating System Basics
1. What are the different types of operating systems? Explain them in detail.
Ans: Types of Operating Systems There are several types of Operating Systems which are mentioned
below.
Multi-Programming System
Multi-Processing System
Personal Computers
1. Time Constraints: Time constraints related with real-time systems simply means that time
interval allotted for the response of the ongoing program. This deadline means that the task
should be completed within this time interval. Real-time system is responsible for the
completion of all tasks within their time intervals.
3. Deterministic Behavior:
RTOS provides predictable and consistent response times to external events. The system
must respond within a known and guaranteed time limit, known as a deadline.
4. Priority-Based Scheduling:
Tasks are assigned priorities, and the scheduler always runs the highest-priority ready task.
This allows urgent tasks to be serviced quickly.
5. Low Latency:
RTOS minimizes the time taken to respond to an interrupt or event. This is important for
applications where immediate reaction is required.
Structure of Os:
a. Monolithic Structure:
In this structure, the entire OS works in kernel space and is a single large program.
All functionalities like file system, memory management, and device drivers are included in the
kernel.
b. Layered Structure:
Each layer performs a specific function and interacts only with adjacent layers.
The bottom layer is hardware, and the top is the user interface.
c. Microkernel Structure:
Only the essential parts of the OS (like process and memory management) run in kernel mode.
Other services (e.g., device drivers, file systems) run in user mode.
D. Modular Structure:
d. Hybrid Structure:
Core OS services run in kernel mode; less critical services may run in user mode.
4. Discuss the advantages and challenges of building and managing
distributed operating system.
A Distributed Operating System (DOS) is a type of operating system that manages a group of
independent computers and makes them appear to the users as a single coherent system. It
allows multiple computers to work together and share resources efficiently.
1. Resource Sharing:
o Users can access and share hardware and software resources (e.g., files, printers,
databases) across the network.
2. Improved Performance:
o If one node fails, others can continue to function, increasing system reliability and
availability.
4. Scalability:
o Easy to expand the system by adding more nodes without affecting the existing
system significantly.
5. Concurrency:
6. Transparency:
1. Complexity:
o Designing and managing a DOS is complex due to the need for coordination,
synchronization, and communication between nodes.
2. Security Issues:
o More difficult to secure data and resources in a distributed environment due to the
involvement of multiple systems and communication over a network.
3. Network Dependency:
o The performance of a DOS heavily depends on the speed and reliability of the
network. Network failure can disrupt the entire system.
4. Data Consistency:
o Maintaining consistency of data across all nodes is challenging, especially in the case
of replication.
o Detecting failures and recovering from them in a distributed system is much harder
compared to centralized systems.
6. Resource Management:
o Efficiently managing resources such as CPU, memory, and storage across different
nodes requires complex algorithms.
5. What is need of for system calls? Explain the types of system calls provided
by an operating system with respect to memory management.
A system call is a mechanism that allows a user-level program to request a service from the
operating system's kernel. Since user programs cannot directly access hardware or critical resources,
system calls act as a controlled interface between the user space and the kernel space.
There are various situations where we must require system calls in the operating system. Following
of the situations are as follows:
2. Network connections require the system calls to sending and receiving data packets.
4. If you want to access hardware devices, including a printer, scanner, you need a system call.
Memory management system calls are used by processes to allocate, deallocate, and manage
memory dynamically during execution. The following are some common types:
These system calls (or their kernel-level equivalents) are used to allocate memory to a
process dynamically.
2.mmap():
This system call maps a file or device into memory, allowing programs to
access the file's contents as if it were a memory region. It's often used for
memory-mapped I/O.
3.munmap():
This system call unmaps a memory region previously mapped using mmap(), freeing up the
memory.
4.shmat():
This system call attaches a shared memory segment to the address space of the calling
process.
shmdt(): This system call detaches a shared memory segment from the address space of a
process.
While free() is a user-level library call, internally it triggers system-level memory deallocation
mechanisms to return memory to the system.