* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Chapter 1: Intro to OS
Survey
Document related concepts
Transcript
Cosc 4740 Chapter 1 Introduction to OS What is an Operating System? • A program that acts as an intermediary between a user of a computer and the computer hardware. • Operating system goals: – Execute user programs and make solving user problems easier. – Make the computer system convenient to use. • Use the computer hardware in an efficient manner. 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 Four Components of a Computer System Computer System Layers O/S Definitions • “An operating system is a program that controls and coordinates the use of hardware resources among various computer programs for various users.” – Resources: CPU, memory, I/O devices etc. – Extended Machine: It allows you to see the machine from a different level, above Hardware so you can use resources. – Control (Control Program): OS controls the execution of various programs to ensure proper use of the hardware resources and to prevent errors. – Coordination (Resource allocator): OS acts as a manager of underlying resources and allocates/ de-allocates resources efficiently and fairly – Ideally: OS must be powerful and easily usable. Brief History of the O/S 1940’s – early 50’s – Thousands of vacuum tubes – single user environment – no high level programming languages, only Machine language – No O/S – straight forward numerical calculations. Mid 50’s to early 60’s – Transistors – more reliable than tubes – punch cards used for long term storage and tape – Batch processing sequential read of each card deck • mainly scientific programs and engineering – FORTRAN and Assembler by IBM Mid 60’s to 70’s – Integrated Circuit (IC) – Multiprogramming –share the cpu among programs, several programs resident at once --use idle time while CPU waits on I/O – Time sharing –several users have access at once – each feel that they are the only one (sort of). – Multitasking – one terminal runs several program at once (one user). 80’s – present – PC – Personal computers. – People start to think about the convenient way of computing o My computer is more convenient to use than shared computer: Personal Computer o Graphic User Interface (GUI) is more convenient than text based command interpreter: Mac OS, Windows series, X-windows – Now, how to share information and resources o Network becomes more popular, Internet becomes very popular o Networking, lead to Distributed Operating Systems – Information security and Resource protection – PCs are too slow to solve the heavy CPU-bounded scientific problems. o Parallel Systems o Super Computers o Well organized distributed systems Dawn of UNIX 1. Growth of minicomputers (DEC PDP-1 ’61 – DEC PDP-11 ’72) 2. Brain Kerningham ported MULTICS (’66) for PDP-7 as single-user version 3. renamed MULTICS to “UNICS” (Uniplexed Information and Computer Service), later the spelling was changes to UNIX which is a trademark of Bell Lab. 4. Dennis Ritchie and Thompson at Bell Lab rewrote UNIX in C 5. AT&T Bell lab licensed UNIX to universities free, then for a small fee. 6. UNIX was added to, updates, and fixed, and spread rapidly through Interdata 7/32, VAX, and Motorola 6800 7. Sys V and BSD versions began to complete with each other. UNIX moved out of Universities to business. 8. UNIX went commercial. Operating System Structure • Multiprogramming needed for efficiency – Single user cannot keep CPU and I/O devices busy at all times – Multiprogramming organizes jobs (code and data) so CPU always has one to execute – A subset of total jobs in system is kept in memory – One job selected and run via job scheduling – When it has to wait (for I/O for example), OS switches to another job Operating System Structure (2) • Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing – – – – Response time should be < 1 second Each user has at least one program executing in memory process If several jobs ready to run at the same time CPU scheduling If processes don’t fit in memory, swapping moves them in and out to run – Virtual memory allows execution of processes not completely in memory Memory Layout for Multiprogrammed System Operating-System Operations • Interrupt driven by hardware • Software error or request creates exception or trap – Division by zero, request for operating system service • Other process problems include infinite loop, processes modifying each other or the operating system • Dual-mode operation allows OS to protect itself and other system components – User mode and kernel mode – Mode bit provided by hardware • Provides ability to distinguish when system is running user code or kernel code • Some instructions designated as privileged, only executable in kernel mode • System call changes mode to kernel, return from call resets it to user Transition from User to Kernel Mode • Timer to prevent infinite loop / process hogging resources – – – – Set interrupt after specific period Operating system decrements counter When counter zero generate an interrupt Set up before scheduling process to regain control or terminate program that exceeds allotted time Types of O/Ss • Multiprocessor Systems – Tightly coupled: Processors share computer bus, clock, memory, and I/O devices. Processors also communicate o Symmetric Multiprocessing: Each processor selfschedule its processes (more complex) o Asymmetric Multiprocessing: Processors are assigned a specific task (master/salve structure) – Loosely coupled: Each processor has its own memory, I/O devices, and clock. Processors do not share computer bus. Processors communicate through communication lines (e.g., LAN, phone lines) • OS for tightly coupled multiprocessor systems (Parallel OS) + Increase throughput + Fault tolerant / Reliable - Increased complexity • OS for loosely coupled multiprocessor systems (Distributed OS) + Increase throughput + Fault tolerant / Reliable + Resource Sharing - Increased complexity Coherency and Consistency • Once an operation (e.g., increment) takes place in the highest memory layer, the value (the operand) is becomes the same (consistent) only after the new value is written back to the permanent storage (e.g., hard disk). – The problem is more complex in tightly-coupled systems – The problem is much more complex in loosely-coupled systems Types of O/Ss Continued • Real-time systems (Real-time OS) o Software Real-time system: A real-time job gets higher priority and maintains it until it completes. (e.g., multimedia and virtual reality applications) - can implement on general computer systems. o Hard Real-time system: Guarantees that real-time jobs complete on time. (e.g., missile control and robotics) - need special hardware to implement • Handheld systems o Specialize hardware (memory, cpu, screen size) o lack of virtual memory, slower CPUs, etc • Limited functionality, with small very limited O/Ss • Next Generation? – think about Moore's law – Quantum Computing – Biological Computing – DNA Computing –? Things to consider is O.S. design 1. O.S. design depends on the hardware Architecture (arch: cpu(s), hardware, bus, etc) - Uniprocessor - multiprocessor - distributed system 2. O.S. design also effected - application to be used: Computing environment - home, business, univ, point of sale, etc. Key concept in O.S • process (not processor) A program in execution, which may be running in the background. – processes must have executable code, data, stack (memory), program counter, ownership, and state of process. Process state is made up of all of these and more. Q&A