1. Operating system

advertisement
Phones OFF Please
Operating System Introduction
Parminder Singh Kang
Home: www.cse.dmu.ac.uk/~pkang
Email: pkang@dmu.ac.uk
1. Computer system consists of :
• Hardware (monitor, keyboard, case, motherboard, disk drives, etc )
• System Software (operating systems, compilers, etc)
• Application Software (database, email client, web browser)
• Translators (enable programs in languages humans can understand
to be executed by the computer)
• Debuggers (assist in debugging programs )
• IDE (a combined editor, compiler and run time environment )
• and Profilers.
2 What is an Operating System?
• It is an interface between;
 User and hardware, Application software and hardware.
 Hides hardware complexity.
• It manages resources ;
 Processors (CPU’s) - applications are allocated execution time on
a CPU(s)
 Memory - allocates real or virtual memory to an application as
required
Peripherals - allocation of disk space, print spooling, etc.
• Coordinator of operations
 Optimising utilisation, i.e. sharing CPU time and disk I/O between
applications.
 Synchronising activities, i.e. between applications and I/O
 Controlling access, i.e. ensuring applications and users only access
resources they have rights too
 Accounting for usage, i.e. to bill users for CPU usage and disk space
used.
……...
User-1
Compiler
User-n
User-2
Assembler
…..….…………..
System and Application Programs
Operating System
Computer Hardware
other applications
3 Desirable features of an O/S
• features can be defined by using two main areas; by User view and
System View.
• user view; OS is designed mostly to ease of use with some attention
paid to performance but none paid to resource utilisation.
• System View; OS acts as a control program. A control program that
manages execution of user programs and prevents errors and improper
use of computer.
• Also, Features of operating system also vary according to system and
application.
Main features of OS are:
• Efficiency
 speed of execution – run applications as fast as
possible
 throughput – maximizes number of applications
put unit time
 resource utilisation e.g. share CPU and I/O
between CPU hungry applications and I/O bound
applications
• Compactness
 memory – O/S uses as little memory as possible.
 external storage – O/S does not fill the disks.
• Quality
 reliability – little or no down time.
 Maintainability – easy to fix problems.
4 Structure of an Operating System
Most O/S are layered - reduces complexity, easier to change
machine dependent bits
User Level
(User mode – unprivileged)
===========================================
Kernel Level
(Protected/privileged mode)
Hardware Independent
Hardware Dependent
For Example: Unix
• Unix Divides Operating System into three main Components:
 The Kernel
 The Shell
 Directory Tree
• Kernel is Core Component of UNIX OS. It is the master program
that manages all physical resources, including;
 File System
 Device Management
 Process Management
 Memory Management
• Shell is an interface between user and kernel.
The primary role of shell is to accept the commands, interprets
these commands and then executes them.
Shell
Kernel
Hardware;
CPU, I/O, Memory
and Storage Devices
5 Operating systems and Unix
• In the past (until the early 1990’s)
 each manufacturer had own O/S, e.g. IBM, DEC, PRIME, CDC, etc.
 some manufacturers had several O/S, e.g. IBM
 generally written in assembly language, i.e. machine dependent!!
 most were very poor & difficult to use!
• In late 1960’s programmers at Bell labs produced UNIX O/S
 target: an interactive timesharing system for professional programmers
 specified the low-level language C as a replacement for assembly language
 O/S was written mainly in C
 minimum (e.g. hardware dependent bits) in assembly language
 Given away free to Universities, etc. – this lead to widespread use!
 Ported to many different hardware configurations
Why Unix?
• Tree structured hierarchal file system
• Consistent structure, i.e. all I/O devices looked the same
• Users files are just a sequence of bytes – O/S imposed no structure on them
• Proper multi-tasking virtual memory O/S
• Networking built in at early stage, e.g. ftp, email, etc.
• Simple system interface
• Powerful Command Line Interpreter (shell) – unprivileged not part of O/S
• Unix is well documented
• Free versions (with source) Linux
• Lots of free software for Unix
Most O/S copy Unix’s ideas
6 Unix structure
--------------------------------| App1 | App2 | ..................|
|---------------------------------|
| Compiler | Editor | Shell |.... |
|---------------------------------|
| Standard Libraries : Open, .... |
|=================================|
| File System | Memory Mgt | .....|
|---------------------------------|
| Process Cntrl | H/W Cntrl |.....|
|=================================|
| Hardware
|
---------------------------------
Application programs
System Programs
User-O/S interface
privileged Kernel
Machine Independent O/S |
|
Machine Dependent O/S |
7 O/S Process Management
• Most O/S are multi-tasking/multi-processing
 Can run many processes (applications, system tasks) concurrently
 CPU execution time shared among the processes
• Gives users virtual processors
 Applications think they have their own CPU and memory
• Processes given a priority; Depending upon resuouce usage?
•O/S schedules processes
 OS schedules processes to run on available CPUs using some
scheduling algorithm, e.g. priority, round-robin, etc
 O/S maintains status of every process
Running, suspended, waiting for I/O, etc
8 O/S File System Management
• Hides details of the physical organisation
 the physical disk structure (tracks, cylinders, sectors)
 users unaware of where files are stored,
e.g. local disks or remote network server
• Provides users with a logical interface
 e.g. named files stored in a tree structure of directories (folders)
• Gives file system a uniform structure
 e.g. no matter how many cylinders or what sector size the file system looks
the same on all disks
• Elements referred to by name, rather than physical position on disk
• All I/O made to look the same data stored on disks, cameras, remote servers, etc.
9 O/S Memory Management
• O/S decides where programs stored in memory
 applications can not access physical memory directly
• With Virtual Memory programs have illusion of (almost) infinite memory
 program address space is broken in pages stored on disk
 O/S moves pages to/from disk and memory as required
a memory management unit (under control of O/S) maps memory
references by a program to physical memory
programs cannot access physical memory outside their own address space,
e.g. operating system memory or memory allocated to other processes
10 O/S User Interface
• Provides the mechanism for human interaction
 i.e. sits in between the user and hardware resources
• The Unix shell (command line processor) is unprivileged.
 i.e. not part of the UNIX O/S
 several shells are available, e.g. bash, csh
 the shell is an interpreted programming language
• GUI’s (windows based Graphical User Interfaces) are easier for novice
 but less powerful than the shell
 programs access O/S using system calls
Download