0% found this document useful (0 votes)
8 views34 pages

Understanding Operating System Structure

Operating system lacture

Uploaded by

raheelmomina622
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views34 pages

Understanding Operating System Structure

Operating system lacture

Uploaded by

raheelmomina622
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Operating System Structure

BY: Mr. Zubair Hasan

Book Reference: Abraham Silberschatz-Operating System Concepts (9th,2012_12)


Operating System
 Imagine you bought a brand-new phone with no software
installed → it can’t do anything, even though hardware is
powerful. Why? (OS needed).

Another example
 OS = manager of a company.
 Hardware = employees,
 users = customers.
 Without a manager, chaos.

Page: 55
Operating System Structure
 The Operating System (OS) structure refers to the way an
operating system is organized into different components or
layers, and how these components interact to provide
services.
 It is essentially the blueprint or architecture of the
operating system.
Why we need OS Structure
 Think of an OS as a city.
 Without structure—roads, zones, utilities—the city would
be anarchy.
 The structure organizes everything so people (programs)
can live and work smoothly
Why we need OS Structure
 Organization & Clarity:
Complex systems (millions of lines of code) need a clear
structure for development and maintenance.
 Modularity:
Breaking into components makes debugging, upgrading, and
adding features easier.
 Efficiency:
Proper structure ensures that processes, memory, I/O, and
files are managed with minimal overhead.
Why we need OS Structure
 Security & Stability:
Well-structured OS enforces boundaries between kernel, user,
and system processes.
 Scalability & Portability:
Easier to adapt the OS to new hardware or environments.
Operating System Services
User and other system programs

GUI batch commandline

User interfaces

System calls

program Resource
I/O operations File systems communication accounting
execution allocation

Protection and
Error detection
security
services

Operating system

hardware

Book Page no: 56


User Interface
1. Command line interface = old railway station (manual
ticket booking)
User Interface
2. Batch Interface -- commands and directives to
control those commands are entered into files, and those
files are executed
User Interface
3. Graphical User Interface = modern online ticket
booking system
Program execution
 The system must be able to load a program into memory
and to run that program.
 The program must be able to end its execution, either
normally or abnormally
I/O Operations
 A running program may require I/O, which may involve a
file or an I/O device
 Recording to a CD or DVD drive or blanking a display screen
File-system manipulation
 Programs need to read and write files and directories.
 They also need to create and delete them by name
 Search for a given file, and list file information.
 Some operating systems include permissions management
to allow or deny access to files or directories based on file
ownership.
Communications
 There are many circumstances in which one process needs
to exchange information with another process.
 Such communication may occur between processes that
are executing on the same computer or between processes
that are executing on different computer systems tied
together by a computer network.
 Two processes may read and write to a shared section of
memory, or message passing.
Error detection
 The operating system needs to be detecting and correcting
errors constantly.
 Errors may occur in
CPU and memory hardware (such as a memory error or a
power failure)
I/O devices (such as a connection failure on a network, or lack
of paper in the printer)
The user program (such as an arithmetic overflow, an
attempt to access an illegal memory location).
 Each type of error, the operating system should take the
appropriate action
 Terminate an error-causing process or return an error code to a
process
 Last option is to halt (Shut down the OS) the system
Resource allocation
 When there are multiple users or multiple jobs running at
the same time, resources must be allocated to each of
them.
 CPU cycles, main memory, and file storage may have
special allocation code
 Others (such as I/O devices) may have much more general
request and release code.
 There may also be routines (sequence of instructions
grouped together to perform a specific task.) to allocate
printers, USB storage drives, and other peripheral devices.
Accounting
 We want to keep track of which users use how much and
what kinds of computer resources. This record keeping
may be used for accounting
Protection and security
 When several separate processes execute concurrently, it
should not be possible for one process to interfere with
the others or with the operating system itself.
 Protection involves ensuring that all access to system
resources is controlled.
 Security starts with requiring each user to authenticate
himself or herself to the system
System Calls
 System Calls is the Interface between program and OS.
 Ordering food at a restaurant. User asks waiter to talk to
kitchen.
User  program
Waiter  system call
Kitchen  OS service.
Types of System Calls
1. Process control
2. File manipulation
3. Device manipulation
4. Information maintenance
5. Communications
6. Protection
Process control
 Imagine a manager (OS) hiring workers (processes). The
manager must start, monitor, suspend, or fire workers as
needed.
 Examples of System Calls:
 fork() → create a new process (hire a new worker).
 exec() → run a new program (assign a new task to a worker).
 exit() → terminate process (worker leaves job).
 wait() → wait for process to finish (manager waits for
report).
File Management
 Think of the OS as a librarian in a big library. Students
(users/programs) can’t go directly to the shelves (disk).
They must ask the librarian to open, read, or write books
(files).
 Examples of System Calls:
open() → librarian gives you a book.
read() → librarian reads part of the book for you.
write() → librarian writes notes inside the book.
close() → you return the book.
delete() → librarian removes the book from library.
Device Management
 Imagine a school computer lab with only a few printers.
The teacher (OS) must manage who can use the printer
(device) and when.
 Examples of System Calls:
request() → student asks teacher to use printer.
release() → student finishes and frees printer.
read() / write() → actually send data to printer or read
from a device.
Information Maintenance
 A student portal shows your grades, profile, and system
info. Similarly, the OS allows programs to query or update
system data.
 Examples of System Calls:
getpid() → program asks “what is my process ID?”
alarm() → set a timer (like a phone alarm).
time() → ask the OS for the current date/time.
settimeofday() → update the system clock.
Communication
 Two friends (processes) want to chat. They can either write
notes and pass through a mailbox (message-passing), or
talk directly on the phone (shared memory). The OS is like
the post office or telephone operator.
 Examples of System Calls:
pipe() → create a one-way pipe between processes.
shmget() → create shared memory.
send() / recv() → send/receive messages.
socket() → create a network communication endpoint.
Protection
 Think of a hostel with rooms. Students (processes) can only
enter their own room. The hostel warden (OS) ensures no
student enters into someone else’s room.
 Examples of System Calls:
chmod() → change file permissions (who can read/write).
umask() → set default permissions.
setuid() → allow controlled privilege change (e.g., run as
admin).
System Programs
 File management
 Status Information
 File modification
 Programming-language support
 Program loading and execution
 Communications
 Background services
Status Information
 Some programs simply ask the system for the date, time,
amount of available memory or disk space, number of
users, or similar status information.
 Print the output to the terminal or other output devices or
files or display it in a window of the GUI.
 Some systems also support a registry, which is used to
store and retrieve configuration information.
File modification
 Several text editors may be available to create and modify
the content of files stored on disk or other storage devices.
Programming-language support
 Compilers, assemblers, debuggers, and interpreters for
common programming languages (such as C, C++, Java) are
often provided with the operating system or available as a
separate download.
Programming-language support
 Compilers: Translate high-level language (C, Java, Python)
into machine code that the computer can understand.
 Assemblers: Convert assembly language (low-level code)
into machine code (binary instructions) that the CPU can
execute.
 Debuggers: Help programmers test and find errors (bugs)
in their code. You can run the program step by step,
inspect variables, and see where it goes wrong.
 Interpreters: Execute high-level code line by line, without
converting the whole program into machine code first
(unlike compilers). It works line by line: Reads the instruction
→ Translates → Executes immediately.
Program loading and execution
 Once a program is assembled or compiled, it must be
loaded into memory to be executed.
Communications
 Communication is creating virtual connections among
processes, users, and computer systems
 Communications also allow users to send messages to one
another’s screens
 Browse Web pages
 Send e-mail messages
 Log in remotely
 Transfer files from one machine to another.
Background services
 Ctrl + ALT + DEL  Task Manager  More Details
 You see a background processes list
 These processes continue to run until the system is halted
 Constantly running system-program processes are known
as services, subsystems, or daemons

Page: 75

You might also like