Assignment No 1 4365
Assignment No 1 4365
Operating System
Arid Id:
22-Arid-4365
Submitted By:
Imaan Adrees
Submitted To:
Mam Iqra Saleem
Submission Date:
21-Oct-2024
Topic: Operating System Structure
1. Explain the main components of an operating system,
Answer:
Operating System a type of system software. It basically manages all the resources of
the computer. An operating system acts as an interface between the software and
different parts of the computer or the computer hardware. The operating system is
designed in such a way that it can manage the overall resources and operations of the
computer.
The Kernel:
The kernel is the most important part of the operating system. It is the primary
interface between the hardware and the processes of a computer. The kernel connects
these two in order to adjust resources as effectively as possible.
It is named a kernel because it operates inside the OS, just like a seed inside a hard
shell. The figure below shows its place in an OS. It controls all of the main functions of
the hardware, whether it’s a tablet, desktop, server, or any other kind of device:
The kernel is one of the initial programs loaded up on memory before the boot loader.
The boot loader is responsible for translating instructions for the central processing unit.
It manages memory as well as peripherals such as keyboards and monitors.
Process management:
Process management is a key part of an operating system. It controls how processes are
carried out, and controls how your computer runs by handling the active processes. This
includes stopping processes, setting which processes should get more attention, and
many more. You can manage processes on your own computer too.
The OS is responsible for managing the start, stop, and scheduling of processes, which
are programs running on the system. The operating system uses a number of methods
to prevent deadlocks, facilitate inter-process communication, and synchronize
processes. Efficient resource allocation, conflict-free process execution, and optimal
system performance are all guaranteed by competent process management. This
essential component of an operating system enables the execution of numerous
applications at once, enhancing system utilization and responsiveness.
Memory Management:
Memory management in an OS ensures programs get the memory they need while
keeping everything organized and running smoothly.
1. Allocating Memory:
- The OS gives space (RAM) to each program when it runs.
2. Virtual Memory:
- If RAM is full, the OS temporarily moves less-used programs to the hard drive (swap
space).
3. Protection:
- Programs can’t interfere with each other’s memory. If they try, the OS stops them
(segmentation fault).
4. Freeing Memory:
- When a program closes, the OS reclaims its memory for other uses.
5. Memory Allocation Strategies:
- Algorithms like first-fit or paging help efficiently assign space.
In short, memory management ensures programs run efficiently, avoid errors, and make
good use of available memory.
File system Management:
File system management in an OS ensures data is stored, organized, and retrieved
efficiently from storage devices like hard drives. The OS organizes files into folders
(directories) to keep things neat and accessible. It also manages file permissions,
determining who can read, write, or execute each file. To store data efficiently, the OS
uses techniques like contiguous, linked, or indexed allocation. It ensures each file has a
unique name and meaningful extensions (like `.txt` or `.jpg`). The OS maintains a file
table, a kind of catalog, to track where each file is stored and its properties (such as size
and creation date). Additionally, it handles errors by trying to repair corrupted files or
marking bad areas on the disk. In essence, file system management ensures data
remains organized, accessible, and protected.
Device Management:
Device management in an OS ensures all hardware devices, like printers, keyboards, and
USB drives, work smoothly with the system. The OS uses device drivers—special
software that helps it communicate with each device. It manages device requests
through a queue to handle multiple tasks efficiently, ensuring no device gets
overloaded. The OS also controls resource allocation, deciding which device gets access
at a given time, and prevents conflicts when multiple programs try to use the same
hardware. Additionally, it monitors device performance, detects errors, and alerts the
user if a device malfunctions. In short, device management ensures all hardware
components are used efficiently and without conflicts.
Security Protection:
Security protection in an OS ensures that the system and its data are safe from
unauthorized access and malicious activities. It manages **user authentication** (like
passwords or fingerprints) to verify identities and uses **permissions** to control who
can access files, programs, and resources. The OS also isolates processes to prevent one
program from interfering with another. **Firewalls** and **antivirus tools** help block
harmful software, while **encryption** protects sensitive data by converting it into
unreadable formats. If suspicious activity is detected, the OS logs events and may alert
administrators. Overall, security protection ensures the system stays safe, private, and
reliable.
Discuss the types of kernels and their roles.
In an OS, the kernel is like the brain that manages communication between hardware
(like memory, CPU) and software (apps). Different types of kernels provide various ways
of doing this efficiently. Here are the main types:
1. Monolithic Kernel:
- All essential OS functions (like file management, process control, and device drivers)
run inside a single large block of code in kernel mode.
- It’s fast but harder to maintain since everything is tightly connected.
Example: Linux.
2. Microkernel:
- Only the most essential functions (like basic process and memory management) are
in the kernel, while other services (like file systems) run separately in user mode.
- It’s more stable and secure but slightly slower.
Example: Minix, QNX.
3. Hybrid Kernel:
- A mix of monolithic and microkernels. It tries to combine the speed of monolithic
kernels with the stability of microkernels by running some services in kernel mode and
others in user mode.
Example: Windows, macOS.
4. Exokernel:
- It provides a bare minimum kernel, giving more control to applications for managing
hardware resources.
- This approach is very fast but requires advanced programming.
Example: Experimental systems like MIT's Exokernel.
In summary, kernels play a crucial role in managing system resources, with each type
offering a trade-off between speed, stability, and control.
How the OS handles process and memory management, the structure and types
of file systems, the interaction with hardware devices, and the mechanisms for
ensuring security and protecting resources.
The OS manages the system by handling processes, memory, files, hardware, and
security efficiently.
1. Process Management:
- The OS runs multiple programs by switching between them quickly (multitasking) and
schedules which one gets CPU time. It ensures processes can communicate safely and
prevents them from getting stuck (deadlock).
2. Memory Management:
- The OS allocates memory to programs, uses virtual memory to extend RAM, and
protects programs from interfering with each other’s memory. It also cleans up unused
memory automatically.
3. File System Management:
- The OS organizes files into folders, tracks their location, and controls access with
permissions. Different file systems like NTFS or ext4 manage how files are stored and
retrieved on disk.
4. Hardware Interaction:
- The OS uses drivers to communicate with devices (like printers or keyboards). It
manages input/output efficiently and handles hardware events (like keypresses)
through interrupts.
5. Security and Protection:
- The OS secures the system with user authentication, access controls, firewalls, and
encryption. It isolates processes to prevent interference and logs activities to detect
threats.
In short, the OS keeps the system running smoothly by managing resources, hardware,
and security.
Describe the different types of operating systems, including:
Batch, time-sharing, distributed, network, and real-time operating systems.
Provide examples of each type, explain their key characteristics, and discuss
their typical applications and advantages.
Answer:
Types of Examples Key Characteristics Typical Advantages
OS
Applications
Batch IBM OS/360, - Executes batches of jobs - Mainframe - Efficient for large
VAX/VMS without user interaction. processing. volumes of similar
Operating - Jobs are collected, - Payroll jobs.
processed, and outputted in systems. - Minimizes idle CPU
System groups. time.
Time- UNIX, Linux, - Multiple users can access - Academic - Provides quick
Windows the system simultaneously. environments. response times.
Sharing
- Time slices are allocated to - Interactive - Increases resource
Operating each user or process. applications utilization.
System
Distributed Google Cloud, - Manages a group of Cloud Scalability and
Amazon AWS independent computers and computing. resource sharing.
Operating presents them as a single - Collaborative - Fault tolerance and
system to users. applications. reliability.
System - Shares resources across a
network.