0% found this document useful (0 votes)
3 views30 pages

chapter_8

An Operating System (OS) is a crucial program that facilitates communication between users, application programs, and hardware, ensuring convenience and efficiency. It manages resources like CPU, memory, and I/O devices, providing essential services such as program execution, file access, and system security. OS types can be classified based on user interaction and the number of programs they can handle simultaneously, evolving from early manual systems to modern interactive and multiprogramming environments.

Uploaded by

adku98070
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)
3 views30 pages

chapter_8

An Operating System (OS) is a crucial program that facilitates communication between users, application programs, and hardware, ensuring convenience and efficiency. It manages resources like CPU, memory, and I/O devices, providing essential services such as program execution, file access, and system security. OS types can be classified based on user interaction and the number of programs they can handle simultaneously, evolving from early manual systems to modern interactive and multiprogramming environments.

Uploaded by

adku98070
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/ 30

OPERATING SYSTEM OVERVIEW

What is an Operating System (OS)?

An Operating System (OS) is a special program that runs on a computer.


It helps the user and application programs (like MS Word, games, browsers) talk to the hardware (like CPU,
memory, keyboard, mouse, etc.).

Think of it like a manager or middleman who makes sure everything runs smoothly between the software and
hardware.
# Two Main Goals of an Operating System:
1. Convenience

This means the OS is designed to make the computer easier for people to use.

● Instead of having to know how to control the hardware directly (which would be hard!), users can interact with
the computer using a simpler interface, like clicking icons or typing commands.

● It takes care of complex tasks for you — like saving files, opening apps, printing documents, or connecting to
the internet.

● Think of it like a translator: it helps people “talk” to the computer in a way that’s easy for them to understand.

Example:

When you want to open a photo, you just double-click it. The OS figures out which program to use, how to load the
image, and how to display it — all in the background.
2. Efficiency

This means the OS makes sure the computer's resources (like the CPU, memory, and storage) are used in
the best way possible.

● It decides which programs get to use the CPU and when.

● It manages the memory so that programs don’t interfere with each other.

● It controls how files are stored and retrieved from storage devices like hard drives or SSDs.

● It allows many users or programs to work at the same time without crashing the system.

Example:

If you're listening to music, browsing the web, and downloading a file at the same time, the OS makes sure
all those tasks get enough attention from the CPU without slowing each other down.
# The Operating System as a Bridge Between User and
Computer (the operating system as a user/computer interface)
1. Layered View of a Computer System

Imagine a computer as a layered system, like a cake. Each layer plays a role:

● At the top, you have the user (you!).

● Below that are applications like web browsers, games, or word processors.

● Then, you have programming languages that are used to create those applications.

● Below that are utilities and system programs.

● At the bottom, you have the hardware (CPU, memory, hard disk, etc.).

But you (the user) don’t directly deal with the hardware. You usually deal with applications. The Operating
System (OS) sits in the middle and connects everything together.
# Why Do We Need an OS?
If programmers had to write every program to directly control hardware (like telling the CPU exactly what to
do), it would be extremely difficult and time-consuming.

So, the OS is there to:

● Hide the complex hardware details.

● Provide helpful tools and services so developers can build programs more easily.

● Help users run applications smoothly.


# Main Services the OS Provides
1. Program Creation
● When programmers write software, they use tools like editors, debuggers, and compilers.

● These tools are not always part of the OS, but the OS helps run and manage them.

● Without these tools, writing code would be way harder.

2. Program Execution
● To run a program, many steps are needed: loading it into memory, starting it, managing files it uses,
etc.

● The OS takes care of all these steps automatically.

● You just click "Run" or double-click an icon — the OS does the rest.

3. Access to I/O Devices (Input/Output)


● Devices like keyboards, printers, and hard drives need special instructions to work.

● Instead of making the programmer write all those instructions, the OS provides simple commands
like "read" and "write".

● This makes it easier to use devices without knowing how they work internally.
4. Controlled Access to Files

● Files are stored on devices like hard drives or USBs. These have different formats and ways of
working.

● The OS hides the complexity and gives you a simple way to open, save, or edit files.

● It also protects files, especially when many people use the same computer, making sure only
authorized users can access them.

5. System Access and Security

● On shared computers (like in offices or schools), the OS controls who can log in, what they can
access, and what actions they can perform.

● It protects data from being accessed or changed by unauthorized users.


6. Error Detection and Response
● Problems can happen: devices might stop working, programs might crash, or memory might run
out.

● The OS constantly checks for errors and tries to handle them smoothly — by restarting
programs, warning the user, or logging the problem.

● It aims to minimize the damage when errors occur.

7. Accounting and Monitoring


● The OS keeps track of how resources (CPU, memory, disk) are being used.

● This info helps:

○ Improve performance.

○ Plan upgrades.

○ In multi-user systems, it’s also used for billing (e.g., charging users based on how much
time or storage they used).
#Three Important Interfaces
The OS connects different layers of the computer system through interfaces. Here are three main ones:

1. Instruction Set Architecture (ISA)

● This is the language the hardware understands.

● It includes the basic instructions the CPU can perform.

● Application programs use only a part of this (called user ISA).

● The OS has access to more powerful instructions (called system ISA) to control hardware.

2. Application Binary Interface (ABI)

● This is the interface between the OS and application programs.

● It includes system calls (requests from programs to the OS), and defines how programs interact with hardware.

● Helps programs run on different systems without rewriting the code, as long as they support the same ABI.

3. Application Programming Interface (API)

● This is a set of commands and tools that programmers use to write applications.

● APIs simplify tasks like opening a file, connecting to the internet, or displaying graphics.

● Instead of writing low-level code, programmers just use API functions.

● APIs help make software easier to write and more portable to other systems.
# The operating system as resource manager
What Does "Resource Manager" Mean?
A computer is made up of different parts, called resources, which do specific jobs:

● The CPU (processor) handles all the calculations and processing.

● Memory (RAM) stores data and programs while they are being used.

● Storage devices (like hard drives) hold files and programs long-term.

● I/O devices (like keyboards, printers, and screens) allow input and output.

● Programs (software) do tasks the user wants, like editing documents or browsing the web.

The Operating System (OS) is in charge of managing all these resources, making sure they are
used efficiently, fairly, and safely.
# Does the OS Control the Computer Completely?
You might think the OS is always in control — like a boss giving orders. That’s partially true, but there’s something interesting about
how it works:

Two Unusual Things About the OS as a Controller:

1. The OS is just software – It’s a program like any other. It runs on the same CPU as all other programs.

2. The OS gives up control – The OS runs for a short time to manage the system, then gives control to other programs. It
must trust the CPU to return control back to the OS when needed.

How Does This Work in Practice?


Let’s say you want to run a music player:

1. The OS loads the music player into memory.

2. It gives control of the CPU to the music player so it can play the song.

3. While the song is playing, the OS steps aside.

4. If something important happens (like a new song is selected or you click a button), the CPU returns control to the OS.

5. The OS handles the new request and manages the change.

So, the OS isn’t always active, but it orchestrates everything behind the scenes, making sure resources are shared fairly and
efficiently.
# Main Resources Managed by the OS (as shown in Figure 8.2)
1. Memory (Main Memory / RAM)

● RAM stores programs and data that are in use.

● A part of RAM is always used by the OS, especially the kernel (the core part of the OS that handles
basic functions).

● The rest of RAM is used by user programs (apps you run) and the data they use.

● The OS controls how memory is shared so that programs don’t interfere with each other.

2. Processor (CPU)

● The CPU runs programs — it’s the "brain" of the computer.

● The OS decides which program runs, and for how long.

● If you have multiple programs open, the OS switches between them quickly so it feels like they’re
running at the same time.

● In systems with multiple CPUs, the OS must decide how to divide the work across all processors.
3. I/O Devices (Input/Output)

● These are things like keyboards, printers, and screens.

● Each device has its own way of working (its own "language").

● The OS manages when and how these devices are used.

● It lets programs use them without needing to know the hardware details.

4. Files and Storage

● Files are stored on devices like hard drives or SSDs.

● The OS organizes, protects, and controls access to these files.

● It makes sure files are saved properly and that programs don’t accidentally overwrite each other’s data.

5. Programs (Processes)

● Every running app or program is called a process.

● The OS keeps track of all processes:

○ Who started them

○ How much memory they’re using

○ Whether they’re running or waiting

● It ensures they don’t crash into each other or take over the system.
# What Are Operating System "Types"?
Different operating systems (OS) are designed to work in different ways, depending on:

1. How users interact with the system.

2. How many programs the system can handle at the same time.

These two factors help us categorize operating systems.


# Two Main Dimensions (Ways to Classify Operating Systems):
1. Batch vs. Interactive Operating Systems

This dimension is about how the user interacts with the computer.

# Interactive Systems (used in most modern computers)

● You (the user) interact directly with the computer.

● Usually through a keyboard, mouse, and screen.

● You give the computer commands or input, and it responds right away.

● You can use multiple applications, type, click, and get instant feedback.

● Examples: Windows, macOS, Linux desktops.

Example: When you open a browser and type a search, the system responds quickly — that’s an interactive system.

# Batch Systems (older method, rare today)

● Users do not interact with the computer while their program runs.

● Programs (called jobs) from many users are collected (batched) and sent to the computer all at once.

● A computer operator loads the batch into the system.

● The OS runs each program one after another without user interaction.

● Once finished, the system gives users the output (like a printout).

Example: In the 1960s, engineers wrote programs on punch cards, gave them to an operator, and got printed results later.
2. Uniprogramming vs. Multiprogramming

This dimension is about how many programs the system can run at once.

# Uniprogramming (One Program at a Time)

● The OS runs only one program at a time.

● All of the computer's resources (CPU, memory) go to just that one program.

● If that program needs to wait (e.g., for input), the computer stays idle.

● Not efficient, especially when the CPU could be doing something else.

Example: Imagine a teacher helping only one student at a time, even if the student is reading a book and the teacher is just waiting.

# Multiprogramming (Multiple Programs at Once)

● Several programs are loaded into memory at the same time.

● The OS switches quickly between them, using the CPU efficiently.

● While one program is waiting (e.g., for input), another one can run.

● Makes better use of system resources and improves performance.

Example: A teacher helps multiple students at once — while one is reading, she helps another one who has a question.
# What Were Early Computer Systems Like? (Late 1940s – Mid-1950s)
In the early days of computers, there was no operating system (OS). People used the computer by interacting directly with the
hardware. This was a time before Windows, Linux, or even DOS — computers were completely manual.

# How Did Programmers Use Early Computers?


Programmers had to control the computer themselves using a console, which had:

● Toggle switches – for entering data manually (like typing in binary numbers)

● Lights – that showed what the computer was doing (like which instruction or error it was on)

● Input devices – such as card readers (used to read punch cards with instructions)

● Printers – for outputting the results of the program


# How Did They Run Programs?

1. Write the program in machine code (a series of binary instructions the CPU understands).

2. Input it using punch cards or switches.

3. Run the program.

4. If there was an error, lights on the console would show the problem.

5. The programmer had to manually check memory and registers to figure out what went wrong.

6. If everything worked, the results were printed out.

This entire process was very time-consuming and manual.


# What Problems Did Early Systems Have?
There were two major problems with these early systems:

1. 🕒 Scheduling Problems

● Computers were shared by many users, but only one person could use it at a time.

● People signed up for time slots on a sheet of paper, often in blocks of 30 minutes or 1 hour.

● This caused two big issues:

○ If a person finished early, the rest of their time was wasted.

○ If a person ran into errors and needed more time, they had to stop before solving the problem.

This was inefficient and led to lots of idle (unused) computer time.
2. 🧰 Setup Time

● Running a single program (called a job) required many manual steps:

○ Load the compiler into memory (a compiler turns source code into machine code).

○ Load the source code (your written program).

○ Compile the program to create the machine code version.

○ Save the compiled code (called the object program).

○ Load and link the object code with other needed functions (like math functions).

○ Run the final program.

● Each of these steps could mean:

○ Switching tapes or inserting punch card decks manually.

○ Waiting for devices to load or read data.

● If there was an error at any step, you usually had to start over from the beginning.

So, a lot of time was wasted just getting things ready — not even counting the time it took for the program to run!
# This Was Called Serial Processing
● Only one person used the computer at a time.

● Programs were run one after another, in a serial (one-by-one) manner.

● There was no overlap between tasks.

● This process was slow and not efficient.

# How Did People Try to Improve This?


# simple batch systems
🧠 What Is a Simple Batch System?
In early computers, users had to run their programs manually. This wasted a lot of time due to:

● People using the computer one at a time (serial processing)

● Long setup times for each job

So, to save time and use the computer more efficiently, a new system was created: the simple batch system.
🔄 What Changed with Batch Systems?
Instead of users running their programs directly on the computer:

● Users gave their jobs to a computer operator (on punched cards or magnetic tape)

● The operator grouped (batched) the jobs together

● This batch was loaded into the computer all at once using an input device

● A special software called a monitor controlled the job execution

🖥 What Is a Monitor?
A monitor is an early form of an operating system. It was just a program that:

● Stayed in the computer’s main memory

● Controlled the execution of all user jobs

● Handled the scheduling and setup automatically

The part of the monitor that stayed in memory all the time was called the resident monitor.
🧩 How Did a Batch System Work?
From the Monitor’s point of view:
1. The monitor reads one job from the batch.

2. It loads the job into memory.

3. It gives control to the job (lets it run).

4. When the job is finished, control goes back to the monitor.

5. The monitor prints the result.

6. Then it starts the next job right away.

This made sure the computer never sat idle waiting for the next user.

From the Processor’s point of view:


1. The processor first runs instructions from the monitor (the OS).

2. The monitor tells it to load and start a user job.

3. The processor now runs the user’s program.

4. When the user job finishes or crashes, the processor switches back to running the monitor.

This switching between user programs and the monitor continues for every job in the batch.
⌨ What Is JCL (Job Control Language)?
When a job was submitted, it came with some special commands to help the monitor know what to do.

These commands were called Job Control Language (JCL). They started with a $ symbol, like:

$JOB → Start of the job

$FTN → Use the FORTRAN compiler

FORTRAN instructions...

$LOAD → Load the compiled program

$RUN → Run the program

Data...

$END → End of the job

So the monitor reads each JCL command and acts accordingly:

● Loads the compiler when it sees $FTN

● Compiles the code

● Loads the object code

● Runs the program

● Handles any output or errors


🔒 What Hardware Features Were Needed?
To make this work safely and reliably, some new hardware features were introduced:

1. 🛡 Memory Protection
● Prevents the user program from changing or damaging the monitor’s memory area.

● If it tries, an error happens, and the monitor stops the job.

2. ⏱ Timer
● Prevents a user job from running too long.

● If the job takes too much time, a timer interrupt stops it, and control returns to the monitor.

3. 🔐 Privileged Instructions
● Some commands (like for I/O or system control) are only allowed for the monitor.

● If a user program tries to use them, it causes an error.

4. ⚡ Interrupts
● Allows the system to switch quickly between running the monitor and user programs.

● Helps the monitor regain control when needed (e.g., if a job finishes or crashes).
🧮 Was There a Downside?
Yes — the monitor:

● Takes up some memory space

● Uses some processor time

This is called overhead. But even with this


overhead, the system was much more efficient
than letting users run jobs manually.

You might also like