0% found this document useful (0 votes)
3 views

Operating Systems & Resource Management Unit 1

The document provides an introduction to operating systems, detailing their definition, functions, and historical development through four generations. It explains the role of an operating system as a resource manager that allows multiple programs to run simultaneously while managing hardware resources. Key concepts such as processes, memory management, and I/O devices are also discussed.

Uploaded by

Henry Kanenga
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 views

Operating Systems & Resource Management Unit 1

The document provides an introduction to operating systems, detailing their definition, functions, and historical development through four generations. It explains the role of an operating system as a resource manager that allows multiple programs to run simultaneously while managing hardware resources. Key concepts such as processes, memory management, and I/O devices are also discussed.

Uploaded by

Henry Kanenga
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/ 66

INTRODUCTION TO OPERATING SYSTEMS

UNIT 1
Introduction
BY DR D B NTALASHA

1 Introduction to OS - Ntalasha 2020 24/08/2024


Outline
 What is an operating system
 The history of Operating System
 Hardware of operating system
 Important concepts of Operating System

2 Introduction to OS - Ntalasha 2020 24/08/2024


What Is An Operating System

A modern computer consists of:

• One or more processors


• Main memory
• Disks
• Printers
• Various input/output devices

Managing all these components requires a layer of


software – the operating system
3 Introduction to OS - Ntalasha 2020 24/08/2024
What is an Operating System?
 A modern computer is very complex.
 Networking
 Disks
 Video/audio card
 ….
 It is impossible for every application programmer to
understand every detail
 A layer of computer software is introduced to provide a
better, simpler, cleaner model of the resources and manage
them

4 Introduction to OS - Ntalasha 2020 24/08/2024


What Is An Operating System

Figure 1-1. Where the operating system fits in.


5 Introduction to OS - Ntalasha 2020 24/08/2024
What is an Operating System?
 Users use various OS
 Windows, Linux, Mac OS etc.
 User interacts with shell or GUI
 part of OS?
 they use OS to get their work done
 Is device driver part of OS?

6 Introduction to OS - Ntalasha 2020 24/08/2024


What is an Operating System?
 On top of hardware is OS
 Most computers have two modes of operation:
 Kernel mode and user mode
 OS runs in kernel mode, which has complete access to all
hardware and can execute any instruction
 Rest of software runs in user mode, which has limited capability
 Shell or GUI is the lowest level of user mode software

7 Introduction to OS - Ntalasha 2020 24/08/2024


As an extended machine
 Abstraction:
 CPU—process
 Storage –- files
 Memory– address space

 4 types of people:
 Industrial engineer: design hardware
 Kernel designer
 Application programmer: OS’s user
 End users

8 Introduction to OS - Ntalasha 2020 24/08/2024


What is an operating system?
 Two functions:
 From top to down: provide application programmers a clean
abstract set of resources instead of hardware ones
 From down to top: Manage these hardware resources

9 Introduction to OS - Ntalasha 2020 24/08/2024


The Operating System as a Resource
Manager

• Allow multiple programs to run at the same time


• Manage and protect memory, I/O devices, and
other resources
• Includes multiplexing (sharing) resources in two
different ways:
• In time
• In space

10 Introduction to OS - Ntalasha 2020 24/08/2024


As a resource manager
 Modern OS runs multiple programs of multiple users at the
same time
 Imagine what would happen if several programs want to print at
the same time?
 How to account the resource usage of each process?
 Resources can be multiplexed:
 How to ensure fairness and efficiency?

11 Introduction to OS - Ntalasha 2020 24/08/2024


summary
 Operating system is a software
 Is a complex software
 Runs in kernel mode
 Manages hardware
 Provide a friendly interface for application programmer

12 Introduction to OS - Ntalasha 2020 24/08/2024


History of Operating Systems
Generations:

• (1945–55) Vacuum Tubes


• (1955–65) Transistors and Batch Systems
• (1965–1980) ICs and Multiprogramming
• (1980–Present) Personal Computers

13 Introduction to OS - Ntalasha 2020 24/08/2024


1st: vacuum tubes
 Large and slow
 Engineers design, build, operate and maintain the computer
 All programming is done with machine language, or by
wiring circuits using cables
 insert plugboards into the computer and operate
 The work is mainly numerical calculations

14 Introduction to OS - Ntalasha 2020 24/08/2024


2nd: transistors and batch systems
 Also called mainframes
 Computers are managed by professional operators
 Programmers use punch card to run programs; operators
operate (load compiler, etc ) and collect output to the user
 Complains soon come:
 Human Operation between computer operation
 Lead to batch system
 Collect a batch of jobs in the input room, then read them into a
magnetic tape; the same for output

15 Introduction to OS - Ntalasha 2020 24/08/2024


2nd: Transistors and Batch Systems (1)

Figure 1-3. An early batch system.


(a) Programmers bring cards to 1401.
(b)1401 reads batch of jobs onto tape.
Introduction to OS - Ntalasha 2020
16 24/08/2024
Transistors and Batch Systems (2)

Figure 1-3. (c) Operator carries input tape to 7094.


(d) 7094 does computing. (e) Operator carries output tape to
17 1401.
Introduction to OS - Ntalasha 2020 (f) 1401 prints output. 24/08/2024
Transistors and Batch Systems (4)

Figure 1-4. Structure of a typical FMS job.


18 Introduction to OS - Ntalasha 2020 24/08/2024
3rd: IC and Multiprogramming
 OS/360: a dinosaur stuck in a tar pit
 Aims to adapts 1401/7904, covers all trades of life
 However, OS/360 introduces several key techniques
 Multi-programming: solve the problem of CPU idling
 Spooling: simultaneous peripheral operation on line
 Whenever a job finishes, OS load a new job from disk to the empty-
partition

19 Introduction to OS - Ntalasha 2020 24/08/2024


3rd: ICs and Multiprogramming

Figure 1-5. A multiprogramming system


20 with
Introduction to OS - Ntalasha 2020three jobs in memory. 24/08/2024
3rd: Ics and Multiprogramming
 Problems:
 3rd generation OS was well suited for big scientific calculations
and massive data processing
 But many programmers complain a lot… for not be able to
debug quickly…. Why?
 And the solution to this problem would be….?
 Timesharing:
 A variant of multiprogramming
 Provide both fast interactive service but also fits big batch work

21 Introduction to OS - Ntalasha 2020 24/08/2024


3rd: IC and Multiprogramming
 A system to be remembered: MULTICS
 A machine that would support hundreds of simultaneous
timesharing users– like the electricity system (like a web server
nowadays)
 Introduces many brilliant ideas but enjoys no commercial
success
 Its step-child is the well-known and time-honored UNIX
 System V/ FreeBSD, MINIX, Linux

22 Introduction to OS - Ntalasha 2020 24/08/2024


4th: personal computers
 Computers have performance similar to 3rd generation, but
prices drastically different
 CP/M
 First disk-based OS
 1980, IBM PC, Basic Interpreter, DOS, MS-DOS
 GUI--Lisa—Apple: user friendly
 MS-DOS with GUI– Win95/98/me—winNT/xp…

23 Introduction to OS - Ntalasha 2020 24/08/2024


Summary
 4 generations OS
 Develops with hardware and user needs
 Multi-user, multi-programming, time-sharing

24 Introduction to OS - Ntalasha 2020 24/08/2024


Computer Hardware Review

Figure 1-6. Some of the components


25 of a 2020
Introduction to OS - Ntalasha simple personal computer. 24/08/2024
Hardware: processor
 Brain of computer
 Fetches instruction from memory and execute
 Cycle of CPU:
 fetch, decode, execute
 CPU has registers to store variable and temporary result: load
from memory to register; store from register to memory
 Program counter: next instruction to fetch
 Stack pointer: the top of the current stack
 PSW: program status word, priority, mode…

26 Introduction to OS - Ntalasha 2020 24/08/2024


A reference
 Adam Smith: Wealth of Nation Of the Division of labor

 One man draws out the wire, another straights it, a third cuts
it, a fourth points it, a fifth grinds it at the top…
 One person could make up to forth-eight thousand pins in a
day

27 Introduction to OS - Ntalasha 2020 24/08/2024


CPU Pipelining

Figure 1-7. (a) A three-stage pipeline. (b) A superscalar CPU.


28 Introduction to OS - Ntalasha 2020 24/08/2024
CPU Pipeline
 Accelerate the execution
 Cause headaches to OS/compiler writers
 For superscalar: instructions are often executed out of order

29 Introduction to OS - Ntalasha 2020 24/08/2024


Multithreaded and Multicore Chips

Figure 1-8. (a) A quad-core chip with a shared L2 cache.


30 (b)
Introduction A -quad-core
to OS Ntalasha 2020 chip with separate L2 caches.
24/08/2024
Memory (1)

Figure 1-9. A typical memory hierarchy.


31 The
Introduction to OSnumbers
- Ntalasha 2020are very rough approximations.
24/08/2024
memory
 Memory is where computer fetch and store data, ideally, it
should be both chip/large
 The best people can do, is to construct a memory hierarchy
 Cache lines:
 Memory divided into cache lines; the mostly used ones are stored
in caches
 Cache hit, cache miss
 Cache: whenever there is disparity in usage or speed; used to
improve performance

32 Introduction to OS - Ntalasha 2020 24/08/2024


Memory (2)

Questions when dealing with cache:

• When to put a new item into the cache.


• Which cache line to put the new item in.
• Which item to remove from the cache when a
slot is needed.
• Where to put a newly evicted item in the larger
memory.

33 Introduction to OS - Ntalasha 2020 24/08/2024


Disks

Figure 1-10. Structure of a disk drive.


34 Introduction to OS - Ntalasha 2020 24/08/2024
Disks
 Cheap and large: two orders better than RAM
 Slow: three orders worse than RAM
 Mechanical movement to fetch data
 One or more platter—rotate– rpm
 Information is stored on concentric circles
 Arm, track, cylinder, sector
 Disk helps to implement Virtual Memory
 When no enough memory is available, disks are used as the
storage, and memory as cache

35 Introduction to OS - Ntalasha 2020 24/08/2024


I/O Devices

Figure 1-11. (a) The steps in starting an I/O device and


36 getting an interrupt.
Introduction to OS - Ntalasha 2020 24/08/2024
I/O devices
 Two parts: a controller and a device
 Controller: to provide a simpler interface to OS
 Device driver: talks to controller, give commands and accepts
response
 Busy waiting/interrupt/DMA

37 Introduction to OS - Ntalasha 2020 24/08/2024


Booting the Computer
 BIOS—basic input/output system
 On the parentboard, low-level I/O software
 Checks RAM, keyboard and other basic devices
 Determine the boot device: floppy, CD-ROM, disk
 First sector of the boot-device is read into memory
 The sector contains program to check which partition is active
 Then a secondary boot-loader is read into memory and reads in
operating system from the active partition

38 Introduction to OS - Ntalasha 2020 24/08/2024


The Operating System Zoo

• Mainframe operating systems


• Server operating systems
• Multiprocessor operating systems
• Personal computer operating systems
• Handheld operating systems
• Embedded operating systems
• Sensor node operating systems
• Real-time operating systems
• Smart card operating systems
39 Introduction to OS - Ntalasha 2020 24/08/2024
Operating System Concepts
• Processes
• Address spaces
• Files
• Input/Output
• Protection
• The shell
• Ontogeny recapitulates phylogeny
• Large memories
• Protection hardware
• Disks
• Virtual memory
40 Introduction to OS - Ntalasha 2020 24/08/2024
processes
 Process
 Address space: 0-4G; executable program, program’s data, and
its stack
 Other resources like: registers, files, alarms, related processes,
and other information
 A process is fundamentally a container that holds information
for a program to run

41 Introduction to OS - Ntalasha 2020 24/08/2024


Processes

Figure 1-13. A process tree. Process A created two child


processes, B and C. Process B created three child processes,
D, E, and F.
42 Introduction to OS - Ntalasha 2020 24/08/2024
Address Space
 The memory used by a process, in concept
 MOS allows multiple processes in memory simultaneously
 Some processes need more memory than physically
available– virtual memory

43 Introduction to OS - Ntalasha 2020 24/08/2024


Files (1)

Figure 1-14. A file system for a university department.


44 Introduction to OS - Ntalasha 2020 24/08/2024
Files (2)

Figure 1-15. (a) Before mounting, the files on the CD-ROM are not
accessible. (b) After mounting, they are part of the file
45 hierarchy.
Introduction to OS - Ntalasha 2020 24/08/2024
Files (3)

Figure 1-16. Two processes connected by a pipe.


46 Introduction to OS - Ntalasha 2020 24/08/2024
System calls
 System calls is the interface users contact with OS and
hardware
 System calls vary from system to system, but the underlying
concepts are similar

47 Introduction to OS - Ntalasha 2020 24/08/2024


System Calls

Figure 1-17. The 11 steps in making the system call


48 Introduction to OS - Ntalasha read(fd,
2020 buffer, nbytes). 24/08/2024
System Calls for Process Management

Figure 1-18. Some of the major POSIX system calls.

49 Introduction to OS - Ntalasha 2020 24/08/2024


System Calls for File Management (1)

Figure 1-18. Some of the major POSIX system calls.

50 Introduction to OS - Ntalasha 2020 24/08/2024


System Calls for File Management (2)

Figure 1-18. Some of the major POSIX system calls.

51 Introduction to OS - Ntalasha 2020 24/08/2024


Miscellaneous System Calls

Figure 1-18. Some of the major POSIX system calls.

52 Introduction to OS - Ntalasha 2020 24/08/2024


53 Introduction to OS - Ntalasha 2020 24/08/2024
54 Introduction to OS - Ntalasha 2020 24/08/2024
Memory Layout

Figure 1-20. Processes have three segments:


55 text, data, and stack.
Introduction to OS - Ntalasha 2020 24/08/2024
Linking

Figure 1-21. (a) Two directories before linking /usr/jim/memo to


56 ast’stodirectory.
Introduction (b) The same directories after linking.
OS - Ntalasha 2020 24/08/2024
Mounting

Figure 1-22. (a) File system before the mount.


(b) File system after the mount.

57 Introduction to OS - Ntalasha 2020 24/08/2024


Windows Win32 API

Figure 1-23. The Win32 API calls that roughly correspond


58 to the
Introduction to OS - Ntalasha 2020UNIX calls of Fig. 1-18. 24/08/2024
Operating Systems Structure

Monolithic systems – basic structure:

• A main program that invokes the requested


service procedure.
• A set of service procedures that carry out the
system calls.
• A set of utility procedures that help the service
procedures.

59 Introduction to OS - Ntalasha 2020 24/08/2024


Layered Systems

Figure 1-25. Structure of the THE operating system.


60 Introduction to OS - Ntalasha 2020 24/08/2024
Microkernels

Figure 1-26. Structure of the MINIX 3 system.


61 Introduction to OS - Ntalasha 2020 24/08/2024
Client-Server Model

Figure 1-27. The client-server model over a network.


62 Introduction to OS - Ntalasha 2020 24/08/2024
Virtual Machines (2)

Figure 1-29. (a) A type 1 hypervisor. (b) A type 2 hypervisor.


63 Introduction to OS - Ntalasha 2020 24/08/2024
The World According to C
• The C language
• Header files
• Large programming projects
• The model of run time

64 Introduction to OS - Ntalasha 2020 24/08/2024


World according to C
 Operating systems are large C programs consisting of many
pieces written by many programmers
 C language
 Data types, variables, control statements…
 Header files: declaration, definition, macros…
 For a large programming project

65 Introduction to OS - Ntalasha 2020 24/08/2024


The Model of Run Time

Figure 1-30. The process of compiling C and header files to


66
make an executable.
Introduction to OS - Ntalasha 2020 24/08/2024

You might also like