0% found this document useful (0 votes)
26 views33 pages

OS Lecture 1

An operating system (OS) is essential software that mediates between computer hardware and users, managing resources like CPU, memory, and storage while providing user interfaces. It has evolved from early systems with no OS to modern multitasking and secure environments, supporting various types such as batch, time-sharing, real-time, and embedded operating systems. Key functions include resource management, process management, file management, and user interaction, facilitated through system calls that allow applications to request services from 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)
26 views33 pages

OS Lecture 1

An operating system (OS) is essential software that mediates between computer hardware and users, managing resources like CPU, memory, and storage while providing user interfaces. It has evolved from early systems with no OS to modern multitasking and secure environments, supporting various types such as batch, time-sharing, real-time, and embedded operating systems. Key functions include resource management, process management, file management, and user interaction, facilitated through system calls that allow applications to request services from 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/ 33

WHAT IS AN OPERATING SYSTEM?

An operating system (OS) is a sophisticated and essential software


layer that acts as an intermediary between computer hardware
and the user. It provides a platform for running applications and
managing system resources efficiently and securely.

Think of it as the "brain" of your computer, orchestrating all the


activities and ensuring everything works together harmoniously!
WHAT IS AN OPERATING SYSTEM?
Key Functions:

(1) Resource Management: The OS meticulously manages and


allocates critical hardware resources, including:

• Central Processing Unit (CPU): The OS schedules and assigns


processes to the CPU, ensuring fair execution time and maximizing
utilization. It employs various scheduling algorithms to optimize
performance based on factors like priority and resource
requirements.

• Memory: The OS allocates memory to processes, protects memory


spaces from unauthorized access, and manages virtual memory to
allow programs to use more memory than physically available. It
uses techniques like paging and segmentation for efficient memory
utilization.
WHAT IS AN OPERATING SYSTEM?
Key Functions:

• Storage: The OS manages storage devices like hard drives and


SSDs, organizing files into a hierarchical structure (directories and
files) for easy navigation and access. It also handles file allocation,
free space management, and disk scheduling.

• Input / Output (I/O) Devices: The OS manages communication


with various I/O devices like printers, keyboards, mice, and network
interfaces. It provides device drivers that act as translators between
the OS and the specific hardware.

Example: When you open multiple applications, play music, and


browse the internet simultaneously, the OS juggles these tasks by
allocating CPU time slices, managing memory allocation for each
program, and coordinating data transfer between the applications
and the network interface.
WHAT IS AN OPERATING SYSTEM?
Key Functions:

(2) Process Management: The OS is responsible for the entire


lifecycle of processes (running programs):

• Creation: When you launch an application, the OS creates a new


process, allocating necessary resources like memory and file
handles.

• Execution: The OS schedules processes for execution on the CPU,


managing their states (ready, running, blocked) and ensuring they
run concurrently without interfering with each other.
WHAT IS AN OPERATING SYSTEM?
Key Functions:

(3) File Management: The OS provides a structured way to


organize and manage files on storage devices:

• File System: The OS implements a file system (e.g., NTFS in


Windows, ext4 in Linux) that defines how files are stored,
organized, and accessed.

• File Operations: The OS provides system calls for file operations


like creating, reading, writing, deleting, and renaming files.
WHAT IS AN OPERATING SYSTEM?
Key Functions:

• Directory Structure: The OS organizes files into a hierarchical


directory structure (folders within folders) for easy navigation and
management.

Example: When you save a document, the OS writes the data to


the storage device, updates the file system with the new file's
information (name, size, location), and places it in the appropriate
directory within the file system.
WHAT IS AN OPERATING SYSTEM?
Key Functions:

(4) User Interface: The OS provides a way for users to interact


with the computer:

Command-Line Interface (CLI): Users interact with the OS by


typing text commands. This offers flexibility and power but requires
knowledge of commands.

Example: Linux terminals, Windows Command Prompt

Graphical User Interface (GUI): Users interact with the OS


through visual elements like icons, windows, and menus. This is
more user-friendly for most users.

Example: Windows desktop, MacOS, Android, iOS


HISTORY AND EVOLUTION OF OPERATING SYSTEMS

Early Systems (1950s)

No Operating System: Initially, computers had no OS. Users


interacted directly with the hardware, making programming and
operation very complex and time-consuming.

Batch Processing: To improve efficiency, batch processing


systems were introduced. Jobs were submitted in batches (e.g.,
using punch cards), and the computer processed them sequentially
without user intervention. This reduced idle time but lacked
interactivity.
Examples: IBM 701, UNIVAC I

Limitations: Slow turnaround time, lack of user interaction,


inefficient resource utilization.
HISTORY AND EVOLUTION OF OPERATING SYSTEMS

Time-Sharing Systems (1960s)

Interactive Computing: Time-sharing systems allowed multiple


users to share a single computer simultaneously, enabling
interactive computing. Each user had a terminal and received a
time slice of CPU time, giving the illusion of having dedicated
access to the computer.

Examples: Compatible Time-Sharing System (CTSS), Multics,


UNIX
Advantages: Improved response time, better resource
utilization, enabled interactive applications.
HISTORY AND EVOLUTION OF OPERATING SYSTEMS

Personal Computer Operating Systems (1980s)

User-Friendly Interfaces: The rise of personal computers led to


the development of OS with user-friendly interfaces, making
computers accessible to a wider audience.

MS-DOS: A command-line based OS that was widely used in


early PCs.

Apple Macintosh OS: Introduced the graphical user interface


(GUI) with icons, windows, and a mouse, revolutionizing user
interaction.

Advantages: Increased accessibility, ease of use, spurred the


development of graphical applications.
HISTORY AND EVOLUTION OF OPERATING SYSTEMS

Modern Operating Systems

Multitasking, Networking, and Security: Modern OS are


characterized by multitasking (running multiple programs
concurrently), networking capabilities (connecting to the internet
and other computers), and robust security features to protect user
data and system integrity.
Examples:
Windows: Dominates the desktop market, known for its
user-friendly interface and wide software compatibility.
MacOS: Popular for its elegant design and creative
applications, used primarily on Apple computers.
Linux: Open-source OS known for its stability, security,
and flexibility, widely used in servers and embedded
systems.
Android: Dominates the mobile market, based on Linux,
offers a vast app ecosystem.
iOS: Powers Apple's mobile devices (iPhones, iPads),
known for its user-friendly interface and focus on security.
TYPES OF OPERATING SYSTEMS

(1) Batch Operating Systems:


No Direct User Interaction: Batch OS process jobs in batches
without direct user interaction. Jobs are submitted in advance (e.g.,
through punch cards or files), and the OS executes them one after
another.
Focus on Throughput: The primary goal is to maximize
throughput (number of jobs processed in a given time) and
efficiently utilize system resources.
Examples:
Payroll processing: Processing employee salaries at the end
of the month.
Bank statement generation: Generating monthly statements
for bank customers.
Scientific simulations: Running complex simulations that
require significant processing time.
TYPES OF OPERATING SYSTEMS

(2) Time-Sharing Operating Systems:

Multiple Users, Concurrent Access: Time-sharing OSes allow


multiple users to share a single computer simultaneously, providing
each user with the illusion of having their own dedicated machine.

Time Slices: The CPU time is divided into small time slices, and
each user's process gets a turn to execute during its allocated time
slice.

Interactive Computing: This enables interactive computing,


where users can receive immediate feedback and responses to their
actions.
TYPES OF OPERATING SYSTEMS

(2) Time-Sharing Operating Systems:

Examples: Web servers: Handling requests from multiple users


accessing a website simultaneously.

Airline reservation systems: Allowing multiple travel agents to


book flights concurrently.

Online gaming servers: Managing multiple players interacting in


a game environment.
TYPES OF OPERATING SYSTEMS

(3) Real-Time Operating Systems (RTOS):

Guaranteed Response Times: RTOS are designed for


applications where response times are critical. They guarantee that
tasks will be completed within a specific deadline, even under heavy
system load.

Predictable Behavior: RTOS prioritize tasks based on their


deadlines and ensure predictable behavior, making them suitable
for applications where even minor delays can be catastrophic.
TYPES OF OPERATING SYSTEMS

(3) Real-Time Operating Systems (RTOS):

Examples:
Industrial control systems: Controlling robotic arms in factories,
managing automated production lines.

Medical devices: Pacemakers, ventilators, insulin pumps, where


timely operation is crucial for patient safety.

Aircraft flight control systems: Ensuring real-time response to


pilot inputs and sensor data.

Automotive systems: Controlling engine functions, braking


systems, and safety features in modern vehicles.
TYPES OF OPERATING SYSTEMS

(4) Embedded Operating Systems:

Resource-Constrained Devices: Embedded OSes are designed


for specific devices with limited resources, such as memory,
processing power, and storage.

Tailored Functionality: They are often tailored to the specific


needs of the device and its applications, providing only the
necessary features to minimize resource usage.
TYPES OF OPERATING SYSTEMS

(4) Embedded Operating Systems

Examples:
Smartphone: Android and iOS are examples of embedded OS that
power our smart phones.
Digital cameras: Embedded OS control camera functions like
image processing, storage, and display.
Cars: Modern cars have numerous embedded systems for engine
control, infotainment, and safety features.
Smart TVs: Embedded OS provide the functionality for streaming
services, apps, and internet connectivity in smart TVs.
Wearable devices: Smart watches and fitness trackers use
embedded OS to track activity, provide notifications, and run apps.
Internet of Things (IoT) devices: Embedded OS power a wide
range of IoT devices like smart home appliances, sensors, and
industrial equipment.
OPERATING SYSTEM STRUCTURES

1. Monolithic Structure:

All in Kernel: In a monolithic architecture, the entire operating


system runs in kernel mode. This means all OS components,
including file systems, device drivers, and memory management,
have direct access to hardware.

Simple Design: Monolithic kernels are relatively simple to design


and implement, as all components reside in a single address space.
OPERATING SYSTEM STRUCTURES

1. Monolithic Structure:

Less Secure: However, this simplicity comes at the cost of security.


A bug or crash in one component can potentially bring down the
entire system.

Performance Issues: Monolithic kernels can also suffer from


performance issues as the entire kernel needs to be loaded into
memory, even if only a small portion is actively used.

Examples: Early versions of Unix, MS-DOS


OPERATING SYSTEM STRUCTURES

2. Layered Structure

Modular Design: The layered approach organizes the OS into a


hierarchy of layers, each with specific functions and well-defined
interfaces. This modularity makes the OS easier to develop,
maintain, and debug.

Increased Security: Each layer only interacts with the layers


directly above and below it, limiting the impact of errors and
improving security. A bug in one layer is less likely to affect other
layers.

Examples: THE operating system, MULTICS


OPERATING SYSTEM STRUCTURES

3. Microkernel Structure:

Minimal Kernel: In a microkernel architecture, only the most


essential services, such as address space management, inter-
process communication (IPC), and basic scheduling, run in kernel
mode. Other services, like file systems, device drivers, and network
protocols, run in user space as separate processes.

Enhanced Security and Reliability: This separation improves


system stability and security. If a service in user space crashes, it
won't affect the kernel or other services.
OPERATING SYSTEM STRUCTURES

3. Microkernel Structure:

Flexibility and Extensibility: Micro kernels are more flexible


and extensible, as new services can be added without modifying the
kernel.

Performance Overhead: However, micro kernels can introduce


performance overhead due to the increased communication between
components in user space and kernel space.

Examples: Mach (used in MacOS), QNX (used in automotive and


industrial systems), MINIX
SYSTEM CALLS

3. Microkernel Structure:

Definition: System calls are the fundamental interface between


user programs and the operating system. They provide a way for
applications to request services from the OS, such as accessing files,
managing processes, or communicating with other programs.

Think of system calls as the "API" for the operating system,


allowing applications to tap into its powerful capabilities.
SYSTEM CALLS

Mechanism:

User Program Request: When a user program needs a service


from the OS, it issues a system call using a special instruction.

Trap to Kernel Mode: This instruction triggers a software


interrupt, causing the CPU to switch from user mode to kernel
mode.

OS Service Execution: The OS identifies the requested system


call and executes the corresponding kernel function to provide the
service.

Return to User Mode: Once the service is complete, the OS


returns control to the user program, and the CPU switches back to
user mode.
SYSTEM CALLS

Categories of System Calls:

(1) Process Control:


fork(): Creates a new child process that is an exact copy of the
parent process.
Example: A web server might use fork() to create a new
process for each incoming client request.

exec(): Replaces the current process image with a new program.


Example: A command shell uses exec() to run the program
specified by the user's command.
SYSTEM CALLS

Categories of System Calls:

(1) Process Control:

wait(): Suspends the calling process until a child process


terminates.
Example: A parent process might use wait() to monitor the
execution of its child processes.

exit(): Terminates the calling process and returns an exit status


code.
Example: A program uses exit() to signal successful completion or
an error condition.
SYSTEM CALLS

Categories of System Calls:

(2) File Management:

open(): Opens a file for reading, writing, or both.


Example: A text editor uses open() to access the file the user
wants to edit.
read(): Reads data from a file.
Example: A media player uses read() to retrieve audio or video
data from a file.
write(): Writes data to a file.
Example: A word processor uses write() to save the document
to a file.
close(): Closes a file, releasing the associated resources.
Example: After finishing with a file, a program uses close() to
release the file handle.
SYSTEM CALLS

Categories of System Calls:

(3) Device Management:

request(): Requests access to a device, such as a printer or a


network interface.
Example: A print spooler uses request() to gain exclusive access to
the printer.

release(): Releases a device, making it available to other processes.


Example: After finishing printing, the print spooler uses release()
to allow other programs to use the printer.
SYSTEM CALLS

Categories of System Calls:

(4) Information Maintenance:

get time(): Gets the current system time.


Example: A clock application uses get time() to display the current
time to the user.

get process ID(): Gets the unique process identifier (PID) of the
calling process.
Example: A process might use get process ID() to identify itself
when communicating with other processes.
SYSTEM CALLS

Categories of System Calls:

(5) Communication:

send(): Sends a message to another process.


Example: In a client-server application, the client uses send() to
send a request to the server.

receive(): Receives a message from another process.


Example: The server uses receive() to receive the client's request.
SYSTEM CALLS

Categories of System Calls:

Example Scenario: When a web browser wants to download a file


from the internet, it performs the following steps using system
calls:
(i) open(): Creates a new file on the local storage to store the
downloaded data.

(ii) write(): Writes the data received from the internet into the
newly created file. The browser repeatedly calls write() to store
chunks of data as they arrive.
SYSTEM CALLS

Categories of System Calls:

(iii) close(): After the download is complete, the browser uses


close() to close the file, signaling that the file is complete and
releasing the file handle.

(iv) (Implicitly) read(): Although not directly initiated by the


user, the browser might use read() calls internally to display the
downloaded content progressively, such as when streaming a video.

This simplified scenario illustrates how system calls enable a web


browser to interact with the operating system to perform a common
task like downloading a file. The OS handles the low-level details of
file creation, storage access, and network communication, while the
browser focuses on providing the user interface and managing the
download process.

You might also like