operating systems cs208. what is operating system? it is a program. it is the first piece of...

20
Operating Systems CS208

Post on 21-Dec-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Operating Systems

CS208

Page 2: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

What is Operating System?

• It is a program.

• It is the first piece of software to run after the system boots.

• It coordinates the execution of all other software.

• It provides various common services needed by users and applications.

Page 3: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Operating System Definition

• Short definition:– a program that manages a computer’s

resources and acts as an intermediary between a user and those resources

hardware

operating system

computer

application

application

application

user

user

Page 4: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Operating System (OS) Functions

• For the User: Provides a user interface to let the user access hardware and software resources.

• For the System: Manages all the system tasks and resources to provide security, and fair, efficient use.

Page 5: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

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.

Page 6: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Parts of an Operating System

• User Interface– Menu– Command Language– Graphical User Interface (GUI)

• System Security– Login control

• Process Management– CPU Scheduler

Page 7: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Parts of an Operating System• Memory Management

– Swapper/Pager• Temporarily unused pages are stored on disk

(swapped out)• When they are needed again, they are brought

back into the memory (swapped in)

– Garbage Collection• Resource Management

– File Management– Device Management

Page 8: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Operating System Terminology

• Kernel– Software component that controls the

hardware directly, and implements the core privileged OS functions.

• Process– An executing program.

Page 9: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Time Sharing

• Allows multiple processes to run on the same computer, seemingly at the same time.

• CPU is multiplexed among several processes that are kept in memory (the CPU is allocated to a process only if the process is in memory).

– A process is swapped in and out of memory to the disk as needed.

• OS must manage process scheduling and provide memory protection to keep one program from crashing the system or corrupting other programs.

Page 10: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

CPU Time Slicing for Time Sharing

• Only ONE process can be running on the CPU at a time.

– Each process is allocated a “slice” of time in the CPU.

– When the time runs out, the process is interrupted, and another process is loaded into the CPU.

• The act of giving each process a small slice of time to run is called time slicing.

Page 11: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

CPU Time Slicing

Allocate CPU to Process 1

CPU

Process 1

Process 3

Main Memory

Process 2CurrentProcess

Allocate CPU to Process 2

Allocate CPU to Process 3

Repeat until all processes have completed.

Page 12: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

CPU execution modes

• CPUs supports (at least) 2 execution modes:

– User mode

• The code of the user programs

– Kernel (supervisor, privileged, monitor, system) mode

• The code of OS

• The execution mode is indicated by a bit in the processor status word (PSW) (a register in the CPU)

Page 13: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Protecting Kernel mode

• OS code executes in the Kernel mode

– Called via interrupts and system calls

• Only the OS code is allowed to be executed in the Kernel mode

• The user code must never be executed in the Kernel mode

– The program counter (PC) is only set to point to the OS code when the CPU goes to the Kernel mode

Page 14: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Interrupts

• An interrupt is the way by which the hardware informs the OS of special conditions that require OS attention

• Interrupts cause the CPU not to execute the next instruction

• Instead, the control is passed to OS

Page 15: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

System Calls

• A System Call is used by a process to request a service from the OS

• Typical system calls

– Open/read/write/close the file

– Get the current time

– Create a new process

– Request more memory

Page 16: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Parallel Systems

• Multi-processor systems with more than one CPU in close communication.

• Tightly coupled system – processors share memory and a clock; communication usually takes place through the shared memory.

• Advantages of parallel system:

– Economical

– Increased throughput

– Increased reliability

Page 17: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Parallel Systems

• Symmetric multiprocessing (SMP)– Each processor runs an identical copy of the operating

system.

– Many processes can run at once without performance deterioration.

– Most modern operating systems support SMP

• Asymmetric multiprocessing– Each processor is assigned a specific task; master processor

schedules and allocates work to slave processors.

– More common in extremely large systems

Page 18: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Distributed Systems• Distribute the computation among several physical

computers.

– Each has its own CPU, local memory, stable storage, I/O paths connecting to the environment

• Interconnections

– Loosely coupled system – each processor has its own local memory; processors communicate with one another through various communications lines, such as high-speed buses or telephone lines.

– Systems cooperate to maintain shared state and coordinate global information

Page 19: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Distributed Systems

• Advantages of distributed systems.– Inherent distribution– Speedup - improved performance due to load

sharing– Fault tolerance/Reliability– Resource Sharing– Scalability– Flexibility

Page 20: Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the

Distributed Systems

• Network Operating System– provides file sharing

– provides communication scheme

– runs independently from other computers on the network

• Distributed Operating System– less autonomy between computers

– gives the impression there is a single operating system controlling the network.