Operating Systems System Administration: U. U. Samantha Rajapaksha

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 32

Operating Systems and

System Administration

U. U. SAMANTHA RAJAPAKSHA
M . S C . I N I T, B . S C . ( E N G I N E E R I N G ) U N I V E R S I T Y O F M O R A T U WA
SENIOR LECTURER SLIIT
S A M A N T H A . R @ S L I T. L K
Introduction
Learn the major components of the operating systems

Practice with utilities of Unix system administration.

Students will also apply the knowledge they learn in


the lectures, tutorial and labs to complete the unit's
programming assignment
Method of Delivery
2 Hours Lecture

1 Hour Tutorial

2 Hours Practical

Attendance will be marked.


Assessment Criteria
Mid Term Test (Online) 20% Lessons 1 to 6

Assignment (Online) 20% Based on Practical Sessions (C Language)

Final Examination (Written) 60% Lessons 6 to 12


References
A. Silberschatz, P.B. Galvin, G. Gagne, Operating System Concepts, 10th Edition,
John Wiley & Sons, 2018
Linux Programming
Beginning Linux Programming
4th Edition
by Neil Matthew Richard Stones

PThreads Primer
A Guide to Multithreaded Programming
Bil Lewis Daniel J. Berg
Computer System Structure
Computer system can be divided into four components:
◦ Hardware – provides basic computing resources
◦ CPU, memory, I/O devices
◦ Operating system
◦ Controls and coordinates use of hardware among various applications and users
◦ Application programs – define the ways in which the system resources are used to solve the computing problems of
the users
◦ Word processors, compilers, web browsers, database systems, video games
◦ Users
◦ People, machines, other computers
Abstract View of Components of Computer
What is an Operating System?
An Operating System is a program that acts as an intermediary/interface between a user of a
computer and the computer hardware.
Purposes of OS:
oProvide the environment for program execution and development
o Manage the resources (CPU, memory, IO devices, hard disk, files etc..)
o Provide the access controlling (username and password)
Types of OS
User Interface of the Operating
System
OS Components

Process Management
Main-memory management
Secondary-storage management
File Management
I/O System Management
Protection System
Networking (Distributed Systems)
Command- interpreter System

13
OS Operation

In multiprogramming, OS must ensure that an incorrect (or malicious) program cannot cause other programs to
execute incorrectly.
Many programming errors are detected by the hardware, and the errors are normally handled by the OS.

Dual-mode operation
Hardware provides at least two modes of operations:
◦ User mode – in which user programs run.
◦ Monitor mode, also called Supervisor, System, or privileged mode.
Mode bit is provided by the hardware to indicate the current mode: monitor (0) or user (1).

14
OS Operation (cont.)
Dual-mode operation (cont.)
Some machine instructions that may cause harm are designated (by hardware) as privileged instructions.
◦ E.g., the MSB of the machine code of the instruction is a bit ‘1’

A privileged instruction can be executed only in monitor mode.


At system boot-time the hardware starts in monitor mode  OS is loaded.
OS starts user processes in user mode; a user process could never gain control of the computer in monitor
mode.
When an interrupt or fault occurs hardware switches to monitor mode.

Set user mode

monitor user

Interrupt/fault

15
OS Operation (cont.)

I/O
All I/O instructions are privileged instructions.
How does the user program perform I/O ? Use system call.
◦ Usually takes the form of a trap to a specific location in the interrupt vector.
◦ Control passes through the interrupt vector to a service routine in the OS, and the mode bit is set to a monitor mode.
◦ The monitor verifies that the parameters are correct and legal, executes the request, and returns control to the instruction
following the system call.

16
OS Operation (cont.)

Memory
System must provide memory protection at least for the interrupt vector and the Interrupt Service Routine.
Use two registers that determine the range of legal addresses a program may access:
◦ Base register – holds the smallest legal physical memory address.
◦ Limit register – contains the size of the range.

Memory outside the defined range is protected.


The load instructions for the base and limit registers are privileged instructions.
OS has unrestricted access to monitor and user memory.

17
OS Operation (cont.)

CPU
System must prevent one user program using CPU all the time
◦ Because of getting stuck in an infinite loop, or non-fair users

Use timer interrupt after specified period to ensure OS maintains control


◦ Timer is decremented every clock tick.
◦ When timer reaches value 0, an interrupt occurs.

Timer is commonly used to implement time sharing.


Timer is also used to compute the current time.
Loading timer value is a privileged instruction. Why?

18
OS development (cont.)
Simultaneous Peripheral Operation OnLine (SPOOL):
Goal: To keep I/O and CPU busy all the time.
Use a faster disk as huge buffer  disk was a new technology
Inputs from cards are read into disks.
CPU reads input from disks and outputs are written by CPU to disks.
The I/O of a job is overlapped with its own computation or with another job.
Need a Job Pool – data structure that allows OS to select job that runs next in order to increase CPU utilization  job
scheduling
Card CPU Line
Reader Printer

Disk

19
Multiprogramming
Goal: to increase the CPU utilization
Several jobs are kept in main memory at the same time, and the CPU is
Memory partition
multiplexed among them
It needs these OS features: OS

Job scheduling  OS chooses jobs in the job pool and put them into
memory. Job 1

Memory management  OS allocates the memory for each job.

CPU scheduling  OS chooses one among the jobs in memory (called Job 2
processes) that is ready to run.

I/O allocation. Job 3

20
Time-Sharing/Multitasking Systems
Goal: to provide interactive use of computer system at reasonable cost (one computer –
several users/jobs).

21
Real-time Systems

Well-defined fixed-time constraint – the system is functional if it returns the correct result within the
time constraint.
Hard real-time system.

Guarantees that critical tasks complete on time.

Often used as a control device in a dedicated application

controlling scientific experiments, medical imaging systems, industrial control systems, and some display systems

Secondary storage is limited or absent

data is stored in short-term memory, or in ROM.
Soft real-time system

A critical-time task gets priority over others until it completes.

Limited utility in industrial control robotics.

Useful in applications (multimedia) requiring advanced OS features.

22
Storage Structure

Storage systems are organized in hierarchy in


terms of:
Speed Registers
Cost volatile
Cache
Volatility
Size/capacity
Main Memory

Solid state Disks

Magnetic Disks

Optical Disks Non-


volatile
Magnetic Tapes

23
Performance of various levels of storage
Figure 1.11 (Textbook)

24
Computer Startup
Booting Up the Computer: Booting is a process or set of operations that loads and hence starts
the operating system, starting from the point when user switches on the power button.
bootstrap program is loaded at power-up or reboot
◦ Typically stored in ROM or EPROM, generally known as firmware
◦ Initializes all aspects of system
◦ Loads operating system kernel and starts execution
User
press the Electric Power Wake
start signal Supply up
signal
buttons

CPU
CMOS
Battery
Access to fix
address
CMOS Memory FFFFF

Power ROM
on self (Firmware)
Test (BIOS)
(POST) Bootstrap Load

Load &
Result
execute the
s Pass
Bootstrap
Load
Fail

Load MBR
Generate the Beep
sound and display
the error
Hard Disk Stat OS
Computer-System Architecture

A single-processor system contains only one CPU to execute general purpose instructions
◦ However, it also contains special purpose processors
◦ E.g., disk, keyboard, DMA, graphic controllers
◦ These specialized processors do not run user processes
◦ OS may be able to manage the processors, e.g., task disk controllers to use given scheduling algorithms.
A multiprocessor system contains two or more processors working together
◦ They may share computer bus, system clock, memory, I/O devices
◦ Also called parallel system or multicore system

27
Multiprocessor (cont. )

Three main advantages of multiprocessor system


◦ Increased throughput: get more work done in less time
◦ The speed up in n processor system is NOT n due to overhead
◦ Economy of scale: I/O devices, memory storage, and power supplies can be shared
◦ Increased reliability: failure of one processor does not make the whole system down
◦ Graceful degradation: the system can perform operations proportional to the level of operations of the surviving parts
of the system
◦ Fault-tolerant: the system can continue its function in the event of component failures
◦ Require failure detection, diagnoses, and even correction
◦ May use multiple hardware and software duplicates to execute the same tasks in parallel, and take as output
the result from the majority of the duplicates

28
Multiprocessor (cont.)

Two types of multiprocessor system:


◦ Asymmetric multiprocessing
◦ Symmetric multiprocessing (SMP)

Asymmetric multiprocessing:
◦ Use a master processor to schedule and allocate work to (slave) processors.
◦ Each slave processor waits for instruction from the master or has predefined task
◦ More common in extremely large systems

29
Multiprocessor Systems (cont. )

SMP – not the master-slave model; a more common system


- Each processor runs an identical copy of the OS.
- Each processor has its own registers and cache

However, they share the same memory
- Many processes can run at once without significant performance deterioration
 Need load balancing to improve performance
Symmtric and Asymmetric may be the result of either hardware or software.

30
Clustered Systems

A clustered system consists of multiple CPUs, like multiprocessors


◦ However they are individual systems or nodes
◦ Each node can be a single processor or a multicore
◦ They share storage and communicate via LAN
◦ It offers high-availability service

31
Thank You

You might also like