OS

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Three factors to consider in scheduling

Fairness, Differential responsiveness, Efficiency: maximize throughput and minimize response time.

What are the three tradeoffs across the spectrum of memory technology

Faster access time, greater cost per bit Greater capacity, smaller cost per bit Greater capacity, slower access time

could be due to hardware or software. could be permanent, meaning it persists until it is fixed, or temporary, meaning it may appear and go away. Temporary __ could be transient, such as a power supply disturbance, or intermittent, such as a loose wire

Faults

Microkernel architecture Multithreading Symmetric multiprocessing Distributed operating systems Object-oriented design

Five categories of modern OS design

Thread Examples

Foreground and background work Asynchronous processing: Speed-up execution Modularity: structuring a program logically into threads may aid with program design.

provides efficient computation on arrays of data using SIMD (single instruction multiple data) techniques

GPU (graphical processing unit)

Reasons an OS evolves

Hardware upgrades plus new kinds of hardware New services. This can be in the form of new capabilities the OS needs to provide Fixes

Allow data to be moved to and from the computer and I/O devices.

I/O modules

Fetched instructions load into the

IR (instruction register)

Running multiple programs at the same time presents a variety of problems (4)

Improper synchronization, Failed mutual exclusion, Nondeterminate program operation, Deadlocks

after sequence of execution (branch instruction)

Instruction Actions: Control

data transferred to or from a peripheral device

Instruction Actions: Processor-I/O

transfers data between processor and memory

Instruction Actions: Processor-Memory

Defines the set of machine language instructions that a computer can follow. This is the interface between the hardware and the software. Applications and utilities can only utilize a subset of the instructions. The OS can use the additional instructions.

Instruction Set Architecture (ISA)

Requirements for multiple processes in memory

Isolation, Automatic allocation and management, Support of modular programming, Protection and access control, Long-term storage

Role of PCB

It contains all of the information the OS needs to know about the process. It is used by almost every module in the OS. The set of PCBs defines the state of the OS. Likewise, any change of the structure of the PCB would affect a large number of modules. Therefore, all routines are required to use a PCB handler routine that is responsible for all PCB access

Characteristics of suspend process

It is not immediately available for execution. It may or may not be waiting on an event. (Blocking is not the same as suspending). The process was suspended by an agent (itself, a parent, the OS). The process stays suspended until the agent activates it.

Isolation in multiple processes in multiple processes in memory

Keep process from accessing or overwriting the memory of another

Executing in kernel mode

Kernel Running process

Most OS's support at least two modes of execution

Kernel mode: privileged mode having complete control of system, can execute privileged instructions, all registers, and all memory. (also called system mode or control mode). User mode: less privileged mode for running user programs.

The OS may be designed to support threads itself. The application creates threads by calling operating system functions (an API). The OS schedules and manages individual threads rather than entire processes.

Kernel-Level Threads

Why does a Memory Hierarchy work?

Locality of reference: program execution of instructions and data occurs in clusters. Therefore, as long as a cluster is loaded high up in the memory hierarchy, execution is fast until that cluster is finished and the next cluster is loaded. If we think of program execution as a series of clusters which can load into the highest memory level and execute, then we can see that program execution can be quite fast.

What are some outboard storage types

Magnetic Disk, CD-ROM, CD-RW, DVD-RW, DVD-RAM, Blu-Ray

What is a type of off line storage

Magnetic Tape

Volatile storage for programs and data

Main memory

processes memory management information protection and security scheduling and resource management

Major advances in the development of OS's

What is a process list

May be used to keep track of processes contains an entry for each process Each entry contains a pointer to the process in memory and perhaps process context information as well. Other context information may be stored with the process in memory.

Differential responsiveness in scheduling

May need to discriminate among different classes of jobs with different needs. OS should meet total set of requirements. For example, if a process is waiting to use an I/O device that is free, may wish to schedule it.

MTTF

Mean time to failure

MTTR

Mean time to repair

Desirable hardware features to support a batch OS

Memory Protection, Timer, Privileged instructions, Interrupts

The OS maintains tables about each entity it is managing. 4 categories of information

Memory tables I/O tables File tables Process tables

The kernel is the core piece, or nucleus, of the OS. It contains the most frequently used functions. Main memory contains the OS kernel and any other OS routines currently in use, as well as programs and their data. A "microkernel architecture" assigns only a few essential functions to the kernel, and other OS services are provided by processes that run like any other process. This approach simplifies the implementation, provides flexibility, and lends itself well to distributed computing by treating remote and local processes the same way.

Microkernel Architecture

Two kinds of switching

Mode switch: switch away from process, for example, to run an interrupt handler. Process switch: switch from one process to another process.

how many processes can resided in memory at the same time

More than one

User-Level Threads Disadvantages

Most system calls are blocking for processes. So all threads within a process will be blocked The kernel can only assign processes to processors. Two threads within the same process cannot run simultaneously on two processors

Processor is kept busy by switching between programs in response to events such as I/O activity

Multiprogrammed batch systems

Three major lines of development created problems in timing and synchronization that led to the development of a process

Multiprogrammed batch systems Time-sharing systems Real-time transaction systems

running more than program at a time. Allows one to run while the other waits

Multiprogramming

Process: one or more threads plus associated system resources A process may have multiple threads of execution, where each thread belongs to the process and shares its resources, but executes independently and concurrently with other threads of the process. This is useful for applications that need to perform independent parallel tasks. This is more efficient than creating separate processes.

Multithreading

refers to multiple threads of execution in a single process.

Multithreading

Virtual address space for the process image Resource ownership

Multithreading: Process

Thread execution state (running, etc.) Thread context Stack Local variables Shared access to memory and resources of its process

Multithreading: Thread

Running multiple programs at the same time presents a variety of problems, such as Improper synchronization:

Need a reliable way for one program to wait on another.

Running multiple programs at the same time presents a variety of problems, such as Nondeterminate program operation:

Need program results to be independent of other programs running at the same time

Running multiple programs at the same time presents a variety of problems, such as Deadlocks:

Need to avoid situations in which programs are waiting on each other

Running multiple programs at the same time presents a variety of problems, such as Failed mutual exclusion:

Need to prevent multiple programs from accessing a resource such as a file at the same time

Four primary reasons a process is created

New batch job submitted, Interactive Logon occurred, OS creates one for some service (like printing), Spawned by an existing process.

OS in 1940s and 50s

No operating system, users and applications interacted directly with the hardware

This approach executes the kernel outside of any process. The OS has its own region of memory and its own stack. The OS is a separate entity which manages user processes. So, the idea of a process applies only to user programs. This approach was common on older operating systems.

Nonprocess Kernel

Process Termination Reasons

Normal completion Time limit exceeded Memory unavailable Bounds violation (referenced memory outside its permitted range) Protection error (e.g., write to read-only file) Arithmetic error (e.g., divide by zero) Time overrun (waited event didn't occur in time) I/O failure (file not found, failure to R/W) Invalid instruction Privileged instruction (reserved for the O.S.) Data misuse (wrong type data) Operating system intervention (example: when deadlock occurs) Parent terminates so child processes terminate (on some systems) Termination at the parent request

Desirable hardware features to support a batch OS: Privileged instructions

Only the monitor can do certain things such as I/O commands. If an application wants to do an I/O, it asks the monitor to do it

Process is ready to run, but the swapper must swap the process into main memory before the kernel can schedule it to execute

Ready to Run, Swapped process

ready to run as soon as the kernel schedules it

Ready to Run, in Memory process

Supports applications written to perform a query or update against a database by a user, such as an airline reservation system

Real-time transaction systems

What are some inboard memory types

Registers, cache and main memory

A process has two main characteristics

Resource ownership Scheduling/execution

Protection and access control in multiple processes in memory

Restrict or grant access as needed

What are the two states of a process

Running, not running

Five State Model

Running: Process is executing Ready: process is ready to execute Blocked: process is waiting for an event New: process created but not yet loaded Exit: process is exiting

Mode switch:

Save context (PC, registers, PSW, stack pointers) Set PC to interrupt handler Switch from user mode to kernel mode. Run interrupt handler

A process switch involves these actions

Save context. Update PCB of current process to a non-running state. Move PCB of process to appropriate queue for the state. Select another process to run (runs scheduler routine) Update PCB of the selected process to the running state. Update memory-management data structures. Restore state of newly selected process. Note: more work than a mode switch.

Problems with OS in 1940s and 50s

Scheduling - consisted of sign up sheet to reserve time to use the system. This resulted in wasted time because users might schedule too much or too little time Setup time- without an OS to manage resources, considerable time was spent i setting up a program to run with all of the right resources

Process Control Information

Scheduling and State Information Data Structuring: Interprocess Communication Process Privileges Memory Mgmt Resources Ownership and Utilization

Because users had access to the system on at a time this could be called

Serial Processing

contains processes currently in main memory. Any of these processes could be run next. Running each process in turn is called a "round-robin" technique.

Short term process queue

The process is awaiting an event and has been swapped to secondary storage (A blocked state)

Sleeping, Swapped process

Most I/O are much __ than the processor and why

Slower, rather than have the processor wait for an I/O to finish, the processor could continue processing and be interrupted when a nI/O finishes

For handheld devices where many of the components are on a single chip

SoC (system on a chip)

Redundancy can increase fault tolerance (3 types)

Spatial redundancy Temporal redundancy Information redundancy

Multithreaded applications Multiprocess applications Java applications (JVM can benefit as well) Multi-instance applications (running more than one instance in parallel)

Speedup: Other examples of software that may benefit with multiple cores

Interrupt Cycle

Step 1: Processor executes instruction Step 2: Processor checks to see if an interrupt has occurred Step 3: If interrupt has occurred the processor executes an "interrupt handler" Step 4: The processor saves the system state (the registers) on the stack before executing the interrupt handler

Process state changes can affect the threads of the process:

Suspending a process involves suspending all threads of the process since all threads share the same address space. Termination of a process would terminate all threads within the process.

Reasons for Suspension

Swapping OS Reason User request Timing Parent request: to examine a child process or its activity.

Upon return of mode switch

Switch from kernel mode back to user mode Set PC to program Restore context

One way to manage multiple processors there are multiple processors these processors share same main memory and I/O facilities All processors can perform the same functions (symmetric) An SMP OS can schedule threads on any available processor in the system.

Symmetric Multiprocessing (SMP) have these characteristics

Where and why is system state saved in Interrupt Processing

System State is saved on the stack so that execution can resume in the program when the handler is finished as if the interrupt had never occurred

The pathway for data and instructions to move between the processor, memory, and I/O modules.

System bus

Process Identification Numeric IDs for

The process The parent of the process The user of the process The process ID may be used as the means of cross-referencing other tables. It might simply be an index into the process table.

Process Tables

The process tables may link to or cross-reference the other tables. Process tables must keep track of where the process is located, and the attributes of the process.

a dispatchable unit of work

Thread

Far less time to create a new thread within a process than to spawn a new process (maybe factor of 10 on some systems) Less time to terminate a thread than a process Less time to switch between threads than processes Communication between threads is more efficient than between processes (since they share memory).

Thread Benefits

word processor, thread to periodically save to disk. (Not synchronized with the main processing in the application.)

Thread Examples: Asynchronous processing

spreadsheet, one thread for user interaction and one for executing commands

Thread Examples: Foreground and background work

structuring a program logically into threads may aid with program design.

Thread Examples: Modularity

overlapping activity (read and process) especially on a multiprocessor

Thread Examples: Speed-up execution:

On a uniprocessor with multithreading, threads among the same process or differing processes are interleaved. This is similar to how processes are interleaved without threads.

Thread Interleaving

User-Level Threads Advantages

Thread switching does not involve the kernel: no mode switching Scheduling can be application specific: choose the best algorithm. Can run on any OS. Only needs a thread library

Instruction Set Architecture (ISA) Application Binary Interface (ABI) Application Programming Interface (API)

Three types of interfaces

Principal objective: Minimize response time Source of directives to operating system: Commands entered at the terminal

Time sharing

Multiple users interact with the computer system through computer terminals. Processor time is split among the set of users

Time sharing system

Processor time is shared among a number of active users by giving each user a slice of time.

Time-sharing systems

Queue Movements

A new process is moved to the ready queue. A process is picked to run from the ready queue. A running process moves either to the blocked queue or ready queue, or terminates. When a blocking event occurs, all processes that are blocked and waiting on the event are moved to the ready queue. In large systems, there might be separate event queues to avoid searching the blocked queue. There also may be separate ready queues for different process priorities.

New state

A program in the new state has just been defined. It is not loaded into memory yet. Some systems limit the number of processes in the system

A SMP (symmetric multiprocessors) is a __ and has these characteristics

A single computer system Two or more processors of comparable capability. These processors share the same memory and I/O facilities and are interconnected by a bus such that memory access is about the same for each. Processors share the I/O devices. Processors perform the same functions (symmetric). The system is controlled by an OS that manages the interaction between programs and processors.

Memory tables keep track of

Allocation of main memory to processes. Allocation of secondary memory to processes. Protection attributes of blocks of main or virtual memory (for shared blocks for example). Information needed to manage virtual memory

A process can be thought of having three parts

An executable program The data the program is using The execution context (The execution context includes the information required by the OS to control the process)

Defines a standard for binary portability across programs. The ABI defines the system call interface to the OS and the hardware resources and services available in a system through the user ISA.

Application Binary Interface (ABI)

Gives a program access to the hardware resources and services available in a system through the user ISA supplemented with high-level language library calls. Any system calls are usually performed through libraries. A program can run on another system with the same API after recompilation on the new system.

Application Programming Interface (API)

Unable to execute until an event occurs; process is in main memory (blocked state)

Asleep in Memory process

fraction of time the system is available to service user requests

Availability

Examples of the OS's attempt to control access to the system itself and the information it stores

Availability, Confidentiality, Data integrity, Authenticity

Principal objective: maximize processor use Source of directives to operating system: job control language commands provided with the job

Batch Multiprogramming

Suspended processes

Blocked/Suspend: suspended and awaiting an event. Ready/Suspend: suspended and ready to run.

Example of an early time sharing system. Clock interrupt occurred every .2 seconds and OS could decide to give control to another user. The preempted user's program would be written to disk before reading the next user's program in.To minimize disk I/O, memory was only written out where the incoming program would overlay it.If the new program did not fully overlay the previous program, then a portion of it might still be present when it is time to reload it, thus minimizing the loading effort.

CTSS system

Where is cache memory and what does it do?

Cache memory sits between the processor and main memory and exploits the principle of "locality of reference" by keeping a "working set" of instructions and data in its small but high-speed memory.

What are the five considerations in cache design

Cache size - how big is the entire cache (a small cache still offers a lot of improvement). Block size - how big is a block? Needs to be around the size of a cluster. Mapping function - where to put a new block? Replacement algorithm - how to replace a block? Write policy - when to write a block back to main memory?

A process may use a thread library to create separate threads within itself. These threads are application-level threads, the OS isn't aware of them, it just schedules the process as usual. The application's thread library determines which of the application's threads to run whenever the process is scheduled. The application can spawn new threads which are managed by the thread library. So, the OS runs the process, and the process uses a library to create and manage its threads.

User-Level Threads

There are two ways to implement thread support in an OS

User-Level Threads: the application supports threading through a thread library and the OS isn't aware of threads Kernel-Level Threads: the operating system supports threads itself

Processor state includes the following

User-visible Registers Control and Status Registers (PC, Condition Codes, Status information, PSW) Stack Pointers

State Changes New--> Ready

When OS is ready for a new process

The OS builds the data structures that are used to manage it, and allocates space in main memory for it.

When a new process is created

Exit State

When a program terminates it is no longer eligible to execute. The data structures for a terminated process remain long enough for support and accounting programs to extract information. Afterwards, the process is deleted from the system.

What are the cache principles

When the processor fetches an instruction, a block is read into the cache. When the next instruction is fetched, there is a high probability it is contained in the same cache block, which can be accessed quickly. A cache consists of slots (or lines) of K words. Main memory is divided into blocks of K words. If main memory is size 2N words, then there are M=2N/K blocks of memory. If C is the number of cache slots, C << M. Cache lines are addressed by a tag, which is some number of high-order bits of the address.

Process no longer exists but it leaves a record for its parent process to collect

Zombie process

What happens when a program is executed?

a process is created

SMP Advantages Versus Uniprocessor: Availability

a processor failure only slows the system versus halting it

Why is hierarchy of memory types used

a single memory solution isn't appropriate

MS-DOS supports

a single thread

SMP Advantages Versus Uniprocessor: Incremental growth

add additional processors

A process switch may occur anytime the OS gains control again from the current process. This might happen for:

an interrupt: if time expired, I/O complete, memory fault (page not in memory) a trap: if current instruction creates an error a supervisor call: such as an I/O request

Four types of Program-instruction errors

arithmetic overflow division by zero execute illegal instruction reference outside user's memory space

I/O tables are used to manage the I/O devices and keep track of such things as

availability of a device device assignment to a process device status operation status memory being used for a data transfer

State Changes Ready-->Running

based on scheduling algorithm

A parent process spawns a

child process

Three main objectives of an operating system

Convenience: provide a user/computer interface Efficiency: act as a resource manager for the system Ability to evolve: adaptable to new features, updates and changes

Support of modular programming in multiple processes in memory

Create, destroy, alter size of modules dynamically

Process is newly created and not yet ready to run

Created process

processes a stream of data such as audio or video

DSP (digital signal processor

arithmetic or logic operation on data

Data processing

Other Transitions: New->Ready/Suspend and New->Ready:

could add new process to either queue. Might add to the Ready/Suspend queue if no room in memory or if desired to let OS setup the new process before loading it.

Process Image: User Data

data for the program

The invention of the microprocessor enabled ___ and ___

desktop and handheld computing

Services that the OS may provide: Program execution

details of program execution are handled by the OS

carries out the instruction

execute step

Thread

executes

A simplified view of the processor consists of two phases

fetch and execute

retrieves an instruction from memory

fetch step

Process Control Information: Interprocess Communication

flags, signals, messages

Reasons for Suspension: Swapping

for freeing main memory.

Process Image: System Stack

for parameter passing

Process Control Information: Process Privileges

for resources or memory

Process Control Information: Memory Mgmt

for segmented or virtual memory

OS Techniques for Fault Tolerance: Concurrency controls

helps ensure correct operation and detection of problems such as deadlock.

OS Techniques for Fault Tolerance: Process isolation

helps to prevent a fault in one application from affecting another.

If part of the instruction is an opcode and part an address, then the portion set aside for the opcode determines

how many opcodes there can be

If part of the instruction is an opcode and part an address, then the portion set aside for the address determines

how much memory is directly addressable

Reasons for Suspension: OS Reason

if OS thinks process is causing a problem (for example, deadlock)

Services that the OS may provide: Error detection

if a program has an error the OS takes action to minimize impact and correct or report the error

New Suspend Transitions Blocked/Suspend -> Ready/Suspend

if event occurs while Blocked/Suspend.

Reasons for Suspension: Timing

if infrequently run (utility or accounting program), operator may suspend it between runs.

New Suspend Transitions Ready -> Ready/Suspend

if need to free up memory and there are no blocked processes, or a ready process is of lower priority than the blocked processes.

New Suspend Transitions Ready/Suspend -> Ready

if no ready processes, or if suspended process is higher priority than ready queue processes.

Other Transitions: Blocked/Suspend -> Blocked

if suspended blocked process has higher priority than any suspended ready process.

Other Transitions: Various -> Exit:

if terminates due to normal completion or error, or by parent, or on some systems if parent terminates.

What are the performance advantages of SMP (symmetric multiprocessors)

if work can be done in parallel across the various processors, then there can be a performance gain.

Code that processes an interrupt

interrupt handler

contains processes waiting to run (by being moved to the short-term queue)

long term process queue

Efficiency in scheduling

maximize throughput and minimize response time.

When a program is loaded into memory, it is not just the executable code that is loaded. The program will also need

memory to store its data and its stack.

A program in execution an instance of a program running on a computer the entity that can be assigned to and executed n a processor a unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources

Definition of a process

Redundancy can increase fault tolerance: Spatial redundancy

multiple components

Modern OS's such as Windows and Solaris support

multiple threads per process

Traditional UNIX supports

multiple user processes but only supports one thread per process.

Interrupts improve processor utilization by

notifying the processor of an event versus making the processor wait. With interrupts the processor is free to do something else until the event occurs at which time it will be notified

Process

owns resources

SMP Advantages Versus Uniprocessor: Performance

parallel processing

A child process is spawned from a

parent process

What is the incremental growth advantage of SMP (symmetric multiprocessors)

performance can be enhanced by adding additional processors

lets two processes communicate with each other

pipe

Process Control Information: Data Structuring

pointers to other processes, such as parent-child, queuing, or other structure.

Process Image: Process Control Block (PCB)

process attributes

State Changes Null-->New

process creation

When you run a program, the operating system creates a

process for it

Scheduling may be implemented by using queues of ___

processes

An example of using interrupts to improve processor utilization is in

processing I/O commands

Modern microprocessors may have multiple processors on a single chip called

processor 'cores'

Has the ability to support two logical processors by sharing an execution unit

processor core

What is programmed I/O

processor moves data between I/O module and memory. Processor must wait for I/O to complete.

Process Image: User Program

program to execute

Authenticity in OS access control

protecting against false identities

Confidentiality in OS access control

protecting against unauthorized access to data

Data integrity in OS access control

protecting against unauthorized modification

Availability in OS access control

protecting the system against interruption

Services that the OS may provide: File access

protection mechanisms

OS Techniques for Fault Tolerance: Virtual machines

provides a greater degree of isolation as well as redundancy through multiple virtual machines.

Desirable hardware features to support a batch OS: Interrupts

provides better way to handle transfer of control from the monitor to user programs

Services that the OS may provide: I/O device access

provides generic interface to diverse set of I/O devices

Other Transitions: Running -> Ready/Suspend

rather than returning to the ready queue, could be sent to ready/suspend to free up memory for some higher priority process.

Redundancy can increase fault tolerance: Temporal redundancy

repeating an operation after an error occurs.

Process Control Information: Resources Ownership and Utilization

resources currently owned or history information for the scheduler

One way to achieve parallel processing is by

running more than one process

State Changes Blocked->Exit

same as Ready->Exit.

OS Techniques for Fault Tolerance: Checkpoints and rollbacks

save state so that recovery is possible in the event an error occurs.

State Changes Running->Blocked

service call, I/O request.

What are the availability advantages of SMP (symmetric multiprocessors)

since all processors have equal capability, a failing processor does not halt the system, but only reduces its performance

A process that is not multithreaded is called

single-threaded

Services that the OS may provide: system access

system access is controlled by the OS

State Changes Ready->Exit:

terminated due to parent.

What is an example of multicore computers

the Intel Core i7, which has 4 x86 processor, each with an L2 cache and a shared L3 cache

What are the two solutions for multiple interrupts

Disable interrupts while processing an interrupt. Disadvantage: high-priority interrupt may wait too long and lose data while waiting for a low-priority interrupt to finish. Interrupt Priorities: lets high-priority interrupt execute when processing low-priority interrupt. Interrupts low-priority interrupt just like interrupting a program.

provides the illusion of a single main memory and single secondary memory space for a cluster of separate computers

Distributed OS

Desirable hardware features to support a batch OS: Memory Protection

Don't overwrite the monitor

the time the system is not available

Downtime

Kernel-Level Threads Advantages

the kernel can simultaneously schedule many threads of the same process on many processors blocking is done on a thread level, so one thread in a process can block while another runs (doesn't block the entire process) kernel routines can be multithreaded

When one process creates another

the process is said to spawn the new process

What must occur before a interrupt handler can run?

the processor must save system state (the registers) on the stack

Without interrupts

the processor would have to keep checking to see if an event has occurred

File tables keep track of information about files such as

their location in secondary storage their status other file attributes.

Kernel-Level Threads Disadvantages

thread switching within the same process requires a mode switch to the kernel, which may result in a significant slow down (factor of 10 on some systems).

State Changes Running->Ready

time-out, preemption, yield.

Reasons for Suspension: User request

to debug, the user may suspend execution, examine its activity, and resume execution.

Reasons for Suspension: Parent request

to examine a child process or its activity.

New Suspend Transitions Blocked -> Blocked/Suspend

to free memory.

Redundancy can increase fault tolerance: Information redundancy

use of error correction or detection techniques.

What are the scaling advantages of SMP (symmetric multiprocessors)

vendors can offer a range of products with different price and performance characteristics based on the number of processors in the system

SMP Advantages Versus Uniprocessor: Scaling

vendors can offer products based on number of processors available.

State Changes Blocked->Ready

waited event occurs.

a set of instructions to be executed

Program

Services that the OS may provide

Program development program execution I/O device access File access System access Error detection Accounting

The four types of common interrupts are

Program-instruction exceptions Timer-system timer I/O-completetion of I/O or I/O error Hardware failure-power failure or memory parity error

What are the I/O communication techniques

Programmed I/O Interrupt-driven I/O DMA (Direct Memory Access)

Automatic allocation and management in multiple processes in memory

Programmer should not worry about memory mgmt.

The steps involved in process creation

1) Assign an ID and add to process table. 2) Allocate space for all parts of the process image. 3) Initialize the PCB. 4) Set appropriate linkages (queues or links to other processes). 5) Create other data structures (accounting, billing, performance, etc.)

What are the steps of simple interrupt processing

1: Device controller or other system hardware issues an interrupt (hardware) 2: Processor finishes execution of current instruction (hardware) 3: Processor signals acknowledgement of interrupt (hardware) 4: Processor pushes PSW and PC onto control stack (hardware) 5: Processor loads new PC value based on interrupt (hardware) 6: Save remainder of process state information (software) 7: Process interrupt (software) 8:Restore process state information (software) 9: Restore old PSW and PC (software)

A modern processor chip contains _ cores

2 or 4, enabling a view of 4 to 8 logical processors

OS in 1950s and 60s

A "monitor" program accepts a batch of jobs from the operator and runs each one in turn. The user no longer has direct access to the machine, but instead submits the job to the computer operator to run. The operator batches the jobs together and submits them for execution by the monitor. The monitor (or most of it) remains in memory, called the "resident monitor". The monitor increases efficiency by scheduling each job in turn automatically, and by reducing setup time through a JCL (job control language), which specifies setup steps for the monitor.

This lets applications create threads in user space that are then mapped onto an available pool of threads maintained by the kernel. This approach gets much of the efficiency of User level threads without the problem of blocking all threads of a process. The number of KLTs for an application may be specified by the programmer for best performance.

Combined Approaches

Multicore computers

Combines two or more processors on a single chip (a piece of silicon called a die). Each core typically has all of the components of an independent processor, such as registers, ALU, pipeline hardware, control unit, and caches. One reason for multicores is the limitations of continuing to improve a single processor.

What is interrupt driven I/O

Processor issues I/O command and then goes on to other processing. An interrupt lets the processor know when the I/O is complete, at which time the processor moves the data.

Services that the OS may provide: Program development

Editors and debuggers to assist in program creation

OS software runs within context of a user process. Kernel's program, data & stacks are added to the image of the calling process. Process executes in privileged mode when executing the part that has the operating system code. Key benefit that interrupts are handled within the same process (mode switch instead of process switch). Unix SVR4 follows this model.

Execution within User Processes

The CPU is composed of

PC (program counter) IR (instruction register) MAR (memory address register) MBR (memory buffer register) I/O AR (input/output address register) I/O BR (input/output buffer register)

SMP Advantages Versus Uniprocessor

Performance, Availability, Incremental growth, Scaling

What are advantages of SMP (symmetric multiprocessors)

Performance, availability, incremental growth and scaling

Long-term storage in multiple processes in memory

Persist after computer is off

Process is returning from kernel to user mode, but the kernel preempts it and does a process switch to schedule another process

Preempted process

Desirable hardware features to support a batch OS: Timer

Prevents a job from monopolizing the system

Unix has two special processes that get created when the system first boots

Process 0: the swapper process (the scheduler) Process 1: the init process All other processes in the system have process 1 as an ancestor.

The OS must manage processes. In order to do this, it must maintain information about each process. This information is maintained in a data structure called a

Process Control Block (PCB).

Process Control Block information has three main parts

Process Identification Processor State Information Process Control Information

OS Techniques for Fault Tolerance

Process isolation - helps to prevent a fault in one application from affecting another. Concurrency controls - helps ensure correct operation and detection of problems such as deadlock. Virtual machines - provides a greater degree of isolation as well as redundancy through multiple virtual machines. Checkpoints and rollbacks - save state so that recovery is possible in the event an error occurs.

Process Control Information: Scheduling and State Information:

Process state: ready, running, waiting, ... Priority: high, low, numeric value, etc. Scheduling-related information: for example, time process has been waiting Event: ID of event being waited for.

OS supports two kinds of processes, user processes and system processes. All processes can then be managed according to priority with some OS functions being low priority and others being high. Benefits also seen in multiprocessor environments where OS processes may exploit parallelism.

Process-Based OS

Fairness in scheduling

Processes should get equal treatment (if same class and priority).

(CPU) is the "brain" of the system. It fetches instructions from memory and executes them.

Processor

What is DMA (direct memory access)

Processor delegates the I/O transfer to the DMA module. When processor is notified of completion (by interrupt), the data has already been moved.

In some systems the pipe is one direction only.

True

one program at a time. The program waits for an I/O to finish. This is not an efficient use of the processor

Uniprogramming

the time the system is available

Uptime

Services that the OS may provide: Accounting

Usage statistics can be collected and used for system optimization or billings

All of these together are referred to as the Process Image

User Program: program to execute User Data: data for the program System Stack: for parameter passing Process Control Block (PCB): process attributes

Two modes of operation the processor usually supports

User mode: for user programs, has limitations kernel mode: for the OS, has no limitations

Executing in user mode

User running process


Kaugnay na mga set ng pag-aaral

Chapter 36: Cardiomyopathy & Valvular Heart Disease Evolve Practice Questions

View Set

Stars, Constellations, Planets, and Deep-sky Objects in the Night Sky

View Set

Cold War, Civil Rights, Vietnam War Review

View Set

Chapter 35: Assessment of Immune Function

View Set

Physics Review (Edelman/Penny wrong/s)

View Set

Chapter 5: Motivation Background and Theories

View Set

Marketing Test 3 (chapter 12-15)

View Set