Title: Operating Systems Overview
1Lecture 2
- Operating Systems Overview
2?? ??
- ????? ??
- ????? ?? ??
- 1) ?? ?? ???
- 2) ?? ???? ???
- 3) ?? ???? ???? ???
- 4) ??? ???
- ?? ????? ??
- ??? ??
- ????? ??
3Operating System
- ?? ????? ??? ???? ????
- OS? ???? ??? ??? ?? ????? ??? ??? ????
- OS? ??? ?? ???? ??? ???? ?? ??? ????
- ???? ???? ??? ?????
- ?? ????? ???? ??? ?? ????? ??? ?? ??? ???
(Masking) - ? ????? ???, ??? ?? ?
- OS? ????? ???? ??? ????? ??
4 5OS Services(1)
- ???? ?? ?? ??
- editors, compilers, linkers, and debuggers
- ???? ??
- loading in memory, I/O and file initialization
- I/O ? ??? ?? ??
- ?? ??? ?? ??? ? ?? ???
- ??? ??
- ??? ?? ? ???? ?? ?? ??
- ??? ?? ?? ?? ??
6OS Services(2)
- ?? ??
- ?? ? ?? ???? ??
- memory error
- device failure
- ????? ??
- arithmetic overflow
- access forbidden memory locations
- ???? ??
- ?? ??
- ??? ?? ???
- ?????? ???
- ?? ???? ??
7OS Services(3)
- ?? ??
- ??? ?? ??? ?? ?? ??
- ??? ?? ???? (eg response time)
- ??? ?? ?? ??
- ?? ?? ?? (on multiuser systems)
8????? ??
- OS? ????? ???? ? ??? ??? ????? ??? ????? ??
- Character vs graphic terminals
- paging hardware ?
- OS? ??? ???? ????? ??
- ? internet support ?
- OS? ?? ? ?? ??? ?? ??? ???
- modular construction with clean interfaces
- object oriented methodology
9????? ?? ??
- ?? ?? ???(Serial Processing)
- ?? ???? ???(Simple Batch Processing)
- ?? ???? ?? ?? ??? (Multiprogrammed Batch
Processing) - ??? ???(Time-Sharing Systems)
- Modern Operating Systems
- ?? ???(Parallel Systems) SMP
- ?? ???(Distributed Systems)
- ??? ???(Real-Time Systems)
- ??? ???(Embedded Systems)
10?? ?? ???(Serial Processing)
- ?? ??? ??? ??? ??
- (late 1940smid 1950s)
- ?????? ?? ??? ????? ??
- ????? ??
- ?? ???
- Scheduling ????? job scheduling
- Setup time ??? job? ???? ?? setup time? ??? ??
11?? ?? ?? ??? (1)
- ??? ?? ?? (mid-1950s)
- ?? ??
- ???? ?? ??? ??? ??(job)? ??? ???? ????
- ??? ???? ??? ??? ??? ?? ????(batch)? ???? ????
- ???(Monitor) ????? ????? ? ??? ???? ????
- ?? ???(Resident monitor)? ?? ???? ?? ?????? ????
- ??? ????? ??? ?? ?????? ????(loading)
12?? ?? ?? ??? (2)
- Early batch system
- bring cards to 1401
- read cards to tape
- put tape on 7094 which does computing
- put tape on 1401 which prints output
13(No Transcript)
14???(Monitor)
- ???? ????(?????)?? ? ??(??? ????)? ??? ?? ??
?????? ????(loading) - ??? ???? ?? ??? ???? ??? ????
- ??? ????? ?? ?? ?? ????
- end-of-program ???
- ?? ??
- ??? ??? ????? ???? ?? ???? ????.
15Job Control Language (JCL) (1)
- ????? ?? ??? ??? ??? ?? ?? ??
- what compiler to use
- what data to use
- ?? ??? ? -----------------gtgt
- FTN ? ????? ?? ?? ???? ??? ?? ??? ??
- LOAD? ??? ?? ??? ?????? ???(loading)
- RUN ? ??? ????? ????
JOB FTN ... FORTRAN program ... LOAD RUN ...
Data ... END
16Job Control Language (JCL) (2)
- Structure of a typical FMS job 2nd generation
17?? ?? ????
- CPU ? ?? ??? ??? ????? ??
- ??? ????? ???? ???? ??? CPU? ??? ??? ??? ??? idle
??? ??? - ??? ????? ??? ????? ??? ????
- ????? ?? ?? ????? ???? ?? ???? ???? ???? ??? ???
??
18???? ?? ??(1)
- ??? ??
- ??? ????? ??? ??? ???? ??? ? ??? ??? ?? ?? ??
- ???
- ??? ??? ???? ???? ?? ???
- ??? ??? ??? ????? ????
19???? ?? ??(2)
- ?? ???
- ??? CPU ??? ?? ??
- ??? ??
- ??? ??(?? ?????(Supervisor) ??)
- ???? ???? ???? ???
- ??? ????? ???? ???? ??
- ????
- ??? ????? ??? ??? ??? ??? ????? ? ? ??? ??
20?? ???? ???? ???(1)
- I/O ??? ????? ?? ???? ??? ??? ???
- I/O ???? ?? ????? ???? ??? ???? ????? ????
- ??? ?????? ??? ????? ?? ??(uniprogramming)?? CPU?
???? ????
21?? ???? ???? ???(2)
- ?? ?????? ?? ?? ????? ?? ??, ??? ????? ??? ???
???? ?? CPU ? ?? ????? ??? ? ??. - multitasking (multiprogramming)
22?? ???? ???? ???(3)
23?? ? ?? ????? ?? (1)
24?? ? ?? ????? ?? (2)
25?? ? ?? ????? ?? (3)
26?? ????? ?? ??
- Hardware support
- I/O interrupts and (possibly) DMA
- Memory management
- Memory protection (data and programs)
- Software support from the OS
- Scheduling (which program is to be run next)
- To manage resource contention
27??? ???(Time Sharing Systems)(1)
- ?? ???? ???? ???? ???? ??? ??? ???? ???
- ? ?? ?? ??(Job Turnaround Time)
- ???? ?? ??? ??? ??? ????? ?? 2? ???? ?? ??????
???? - ??? ??? ?? 30?? ???? ???? ??? ? ??
28??? ???(Time Sharing Systems)(2)
- ??? ???? ??? ??? ??? ???? ??? ?? ????? ??? ???
????? - ??? ????? ???? ??? ????? ??
- Time Slice ??? ??? ????? ???? ??
- ?? ?? ??(Respone Time)
- ??? ???? ????? ??? ???? ??? ? ??(??? ?? ??)
- ?? ??? ?? ????? ??
29??? ???(Time Sharing Systems)(3)
?
30Batch Multiprogramming vs. Time Sharing
31Early Example CTSS
- Compatible Time-Sharing System (CTSS)
- Developed at MIT as project MAC
- Time Slicing
- When control was passed to a user
- User program and data loaded
- Clock generates interrupts about every 0.2 sec
- At each interrupt OS gained control and could
assign processor to another user
32CTSS Operation
33Problems and Issues
- ??? ??
- Multiple jobs in memory must be protected from
each others data - ????? ??
- File system must be protected so that only
authorised users can access - ?? ?? ??
- Contention for resources must be handled
- Printers, storage etc
34Modern Operating Systems? ??(1)
- ??? ????? ??? ????? ?? ?? ??
- ??? ????? ??
- multiprocessor machines
- high-speed networks
- faster processors and larger memory
- ??? ????? ???
- multimedia applications
- Internet and Web access
- Client/Server applications
35Modern Operating Systems? ??(2)
- Microkernel Architecture
- Multithreading
- Symmetric Multiprocessing
- Distributed Systems
- Embedded Systems
- Object-Oriented Design
36Microkernel architecture
- ???? ?? ???? ???? ??
- primitive memory management (address space)
- Interprocess communication (IPC)
- basic scheduling
- ?? OS ???? ??? ?? ????(servers) ?? ??
- device drivers, file system, virtual memory
- More flexibility, extensibility, portability
- ?? ????? microkernel ??? ???? ?? ??(? Window-NT
?)
37Multithreading
- ??? ????? ??? ?? ??? thread ?? ????
- ????? ??? ??? ?? task? ????? ?? ????? ?? ????
- ?? ???? ??? ???? ?
- ??? ????? ???? thread? ??? ???? ??? ????
38Symmetric Multiprocessing (SMP)
- ??? ????? ?? ???
- ? ????? ??? ??? ??? ?????? I/O ???
????(symmetric) - ????? ????/???? ?????? ??????(real parallelism)
- Incremental growth
- just add another CPU!
- Robustness
- a single CPU failure does not halt the system,
only the performance is reduced
39Example of parallel execution on SMP
40Distributed Systems
- ??? ????? ?? ???? ?? ???? ?? ?? ??? ??? ???
- Loosely-coupled multiprocessor systems
- Clustered Systems
- ?? ????? ??
- ?? ?? ??????? ?
- ???? ?? ????(load balancing) ?
- ???(reliability) HA(High Availability) ?
41Embedded Systems
- ??, ?? ?? ?? ??? ?? ?? ??? ???? ?? ??? ???
- PDA, ?????, ???? ?? ??? ???? ??? ???? ???
- ??? ??? ??
- ??, ??? ? ?? ??? ?? ??? ??
- ???? ???? ??
- RTOS(Real-time Operating System)- pSos etc
- Window-CE, Embedded Window-XP
- Embedded Linux
42Object-Oriented Design
- ?? ??? ???? ???? ?? ??
- ?? ?? ?? ??? ?? ??? ?? ?? ??? ????? ??? ? ??? ??
- ?????? ???? ???? ??? ???? ??? ??? ?? ????? ??? ?
?? - ?? ?? ? ??? ??? ??????? ??? ???? ??
43??? ?? (1)
- ??? ??(System Calls)
- ??? ????? ???? ?? ?????
- ?? ????? ??? ?? ??
- ????? ????? ?? ??
- ??? ?? ?? ? ?? ?? ????
- ?? ?? ?? ? ?? ?? ??? ?? ???
- ?? ?? ?? / ?? ?? ??
- ?? ?? / ?? ??
- ?? ??
- ??? ??
- ???? ??
44??? ?? (2)
??? ????
??? ??
????
????? ??
45??? ?? ?? ??
- There are 11 steps in making the system call read
(fd, buffer, nbytes)
46??? ?? ?? (1)
- ???? ??(Process Control)
- ???? ?? ? ??
- ???? ?? ? ??
- ???? ?? ?? ? ?? ?
47??? ?? ?? (2)
- A stripped simple shell
- while (TRUE) / repeat forever /
- type_prompt( ) / display prompt /
- read_command (command, parameters) / input
from terminal / -
- if (fork() ! 0) / fork off child
process / - / Parent code /
- waitpid( -1, status, 0) / wait for
child to exit / - else
- / Child code /
- execve (command, parameters, 0) /
execute command / -
-
48??? ?? ?? (3)
- ?? ??(File Management)
- ?? ?? ? ??
- ?? ?? ? ??
- ?? ?? ? ??
- ?? ?? ?? ? ??
49??? ?? ?? (4)
- ???? ??(Directory Management)
- ???? ?? ? ??
- ???? ??
- ????? Mounting
50??? ?? ?? (5)
- ?? ??? ??
- ?? ??(Device Management)
- ?? ?? ? ??
- ??, ??, ???
- ?? ?? ?? ? ??
- ?? ?? ??(Information Maintenance)
- ??, ?? ?? ??
- ??? ?? ?? ?
- ??(Communication)
- ?? ?? ?? ? ??
- ?? ??? ?
51??? ?? ?? (6)
52??? ?? ?? (7)
53???? ??(1)
- ??? ????
- ??? ??? ????
- ???? ??? ?? ?? ??
- ??? ?? ?? ??
- ?? ?? ?? ??
- ??? ??? ?? ??? ????? ??
- ? ????, ??? ???, ???, ??? ?
54???? ??(2)
55UNIX OS ??
56Modern UNIX Kernel
57Modern UNIX Systems
- System V Release 4 (SVR4)
- Solaris 9
- 4.4BSD
- Linux
58Windows Architecture
- Modular structure for flexibility
- Executes on a variety of hardware platforms
- Supports application written for other operating
system
59(No Transcript)
60Operating System Organization
- Modified microkernel architecture
- Not a pure microkernel
- Many system functions outside of the microkernel
run in kernel mode - Any module can be removed, upgraded, or replaced
without rewriting the entire system
61Kernel-Mode Components
- Executive
- Contains base operating system services
- Memory management
- Process and thread management
- Security
- I/O
- Interprocess communication
- Kernel
- Consists of the most used components
62Kernel-Mode Components
- Hardware abstraction layer (HAL)
- Isolates the operating system from
platform-specific hardware differences - Device drivers
- Translate user I/O function calls into specific
hardware device I/O requests - Windowing and graphics systems
- Implements the graphical user interface (GUI)
63Windows Executive
- I/O manager
- Cache manager
- Object manager
- Plug and play manager
- Power manager
- Security reference monitor
- Virtual memory manager
- Process/thread manager
- Configuration manager
- Local procedure call (LPC) facility
64User-Mode Processes
- Special system support processes
- Ex logon process and the session manager
- Service processes
- Environment subsystems
- User applications
65Client/Server Model
- Simplifies the Executive
- Possible to construct a variety of APIs
- Improves reliability
- Each service runs on a separate process with its
own partition of memory - Clients cannot not directly access hardware
- Provides a uniform means for applications to
communicate via LPC - Provides base for distributed computing
66Threads and SMP
- Operating system routines can run on any
available processor - Different routines can execute simultaneously on
different processors - Multiple threads of execution within a single
process may execute on different processors
simultaneously - Server processes may use multiple threads
- Share data and resources between process
67Windows Objects
- Encapsulation
- Object consists of one or more data items and one
or more procedures - Object class or instance
- Create specified instances of an object
- Inheritance
- Support to some extent in the Executive
- Polymorphism