COSC 3355 Operating System Concepts Chapters 1-4

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Asymmetric Multiprocessing

Each processor assigned a specific task/thread with master processor controlling system(master-slave relationship)

Transition from User to Kernel Mode Example

Example: timer to prevent infinite loop/process hogging resources •Set to interrupt after specific period •Operating system decrements counter •When counter zero, then trap •Set up before scheduling process to regain control or terminate program that exceeds allotted time

Four components of Computer System

Hardware(CPU,memory,I/O devices), Operating System(Controls and coordinates use of hardware among various applications and users), Application Programs(Word Processors, compilers, web browsers), Users

Wide-Area Network(WAN)

slower and long distance

Client-Server Computing

•Dumb terminals (thin clients) supplanted by smart PCs •Many systems now servers, responding to (computational or data) requests generated by clients

Define Operating System

(No universally accepted definition) A program that acts as an intermediary between a user of a computer and the computer hardware- purpose is to provide an environment in which a user can execute programs-the primary goal is to make the computer system convenient to use-a secondary goal is to use computer hardware in an efficient manner.

Symmetric multiprocessing(SMP)

(most common) All processors perform tasks within the OS - all processors are peers •Requires careful I/O management •Virtually all modern operating systems support SMP •Multi-core CPU chips becoming trend- multiple computer CPUs on one chip •Blade servers include chassis that hold multiple processor boards, I/O boards, and networking boards(i.e. blades)

I/O operations

A running program may require I/O, which may involve a file or communication with an I/O device.

Program loading and execution

Absolute loaders, relocatable loaders, linkage editors, and overlay-loaders, debugging systems for higher-level and machine language

File

Abstracts physical properties to logical storage unit

Dual mode operation

Allows OS to protect itself and other system components

User Interface

Almost all operating systems have a user interface (UI) -Varies between Command-Line Interpreter (CLI), Graphics User Interface (GUI), Batch (job control language script)

Process Control Example:

As a process control example, consider MSDOS - single-tasking with command line interpreter at start up - no create task call - instead loads program into memory writing over most of itself to give max memory - instruction pointer set to first program instruction - program then runs until error trap (error code saved for later use) or system call to terminate - then small portion of command interpreter not overwritten resumes execution - first task is to reload rest of command interpreter from disk - then makes error code available to user or next program

CLI(Command Line Interpreter)

CLI (Command Line Interpreter) - allows direct command entry -Sometimes implemented in kernel, sometimes by systems program -Sometimes multiple "flavors" implemented - shells -For example in UNIX: Bourne, C, Korn, etc. -Primarily fetches a command from the user and executes it -Sometimes commands built-in, sometimes just names of programs -If the latter (program names), adding new features doesn't require shell modification

What are two principal forms of Operating System Interfaces?

CLI(Command Line Interpreter) and GUI(Graphical User Interface)

Programming-language support

Compilers, assemblers, debuggers and interpreters sometimes provided

Control Program

Controls execution of programs to prevent errors and improper use of the computer

File Management

Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories

Memory Management

Determines what is in memory •Optimizing CPU utilization and computer response to user

Interrupt Vector

Dispatches interrupt to appropriate routine

Multi-threaded process has more than one program counter per thread.(T/F)

False. Multi-threaded process has one program counter per thread.

Programs do not have to be in main memory(RAM) to execute.(T/F)

False. Programs must be(at least partially) in main memory(RAM) to execute.

Direct Memory Access (DMA)

Feature of modern computers that allows certain hardware subsystems within the computer to access system memory independently of CPU operation •Device controller transfers block of data to/from main memory •Interrupts when block transfer completed

Real-Time Embedded Systems

Found on omnipresent embedded computers -VCRs, cars, mobile phones, microwaves, appliances •Very specific tasks; little, specialized, or no user interface •OS vary considerably: general-purpose OS with special-purpose applications, hardware devices with special-purpose embedded OS, hardware device with Application-Specific Integrated Circuits (ASIC's) that perform task without an OS •Embedded systems almost always real-time -i.e. rigid time requirements placed on operation of processor or data flow

Base register

Holds smallest legal physical memory address

CPU Scheduling

If several jobs ready to run at the same time

Timesharing(multitasking)

Is logical extension in which CPU swithces jobs so frequently that users can interact with each job while it is running, creating interactive computing. •Response time should be < 1 second

How is the OS similar to a government?

It provides the means for proper use of the resource of the system although it performs no useful function in and of itself- provides the environment within which programs do work.

"The one program running at all times on the computer" (Everything else is either a system program[ships with the operating system] or an application program)

Kernel of the Operating System

Swapping

Moves processes in and out to run if processes don't fit in memory

Error Detection

OS needs to be constantly aware of possible errors •May occur in the CPU and memory hardware, in I/O devices, in user program •For each type of error, OS should take the appropriate action to ensure correct and consistent computing (sometimes abnormal termination) - via interrupt processing •Debugging facilities can greatly enhance the user's and programmer's abilities to efficiently use the system

Policy v.s. Mechanism(or procedure) [Operating System Design and Implementation]

Policy is what will be done while mechanism(or procedure) is how to do it. Mechanisms determine how to do something, policies decide what will be done The separation of policy from mechanism is a very important principle; it allows maximum flexibility if policy decisions are to be changed later

Types of System Calls:

Process Control, File Management, Device Management, Information Maintenance, Communications

Communications

Processes may exchange information, on the same computer or between computers over a network

System programs

Provide a convenient environment for program development and execution -Some of them are simply user interfaces to system calls; others (most) are considerably more complex

Communications(System Programs)

Provide the mechanism for creating virtual connections among processes, users, and computer systems Allow users to send messages to one another's screens, browse web pages, send electronic-mail messages, log in remotely, transfer files from one machine to another

Network Operating System

Provides integral file sharing, communication among systems running the network operating system

Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing:

Resource allocation, Accounting, and Protection and Security

Program Counter

Specifies location of next instruction to execute

Booting

Starting a computer by loading kernel

File-system manipulation

The file system is of particular interest. Obviously, programs need to read and write files and directories, create and delete them, search them, list file information, permission management, etc.

Protection and Security

The owners of information stored in a multi-user or networked computer system may want to control use of that information; as such, concurrent processes should not interfere with each other -Protection involves ensuring that all access to system resources is controlled (e.g. recall memory protection) -Security of the system from outsiders requires user authentication, extends to defending external I/O devices from invalid access attempts -If a system is to be protected and secure, precautions must be instituted throughout it. A chain is only as strong as its weakest link!

Program execution

The system must be able to load a program into memory and to run that program, end execution, either normally or abnormally (indicating error)

Accounting

To keep track of which users use how much and what kinds of computer resources

Hardware can send trigger on bus at any time.(T/F)

True

Interrupt is driven by hardware.(T/F)

True.

Main memory is volatile. (T/F)

True. Main memory loses contents on power loss

One Set of Operating System Services provides functions that are helpful to the user:

User Interface, Program execution, I/O operations, File-System manipulation, Communications, and Error detection

Resource allocation

When multiple users or multiple processes running concurrently, resources must be allocated to each of them -Many types of resources - some (such as CPU cycles, main memory, and file storage) may have special allocation code; others (such as I/O devices) may have general request and release code.

Virtual Memory

allows execution of processes not completely in memory

Group Identifier(group ID)

allows set of users to be defined and controls managed, then also associated with each process, file

Privilege Escalation

allows user to change to effective ID with more rights

Protection

any mechanism for controlling access of processes or users to resources defined by the OS

CPU HW

compares every address generated in user mode with the registesrs- a fatal error trap then generated if address is illegal - these registers can only be loaded by OS with special privileged instruction - since this instruction can only be executed in monitor mode, only OS can do this - user code prohibited

Limit register

contains size of range

Software error or request

creates exception or trap •Division by zero, illegal memory address, request for operating system service such as I/O(typical), etc.

Security

defense of the system against internal and external attacks •Huge range, including denial-of-service, worms, viruses, identity theft, theft of service

Device Driver(Software)

for each device controller •Knows operation details of controller •Provides uniform interface to kernel

Network

is a communication path between two or more systems

Application Programming Interface(API)

is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API. It serves as an interface between different software programs and facilitates their interaction, similar to the way the user interface facilitates interaction between humans and computers.

Process

is a program in execution such as batch job, time-shared user program, spooling output to printer etc. - process needs resources (such as CPU time, memory, files, I/O devices) to accomplish its task - such resources are given to process when it is created or (more typically) allocated to it while running (via system call request issued by process) - when process complete, OS reclaims any reusable resources from terminated process Each user has at least one program executing in memory

Bootstrap Program

is loaded at power-up or reboot •Typically stored in ROM or EEPROM, generally known as firmware •Initializes all aspects of system •Loads operating system kernel and starts execution OR: code stored in ROM that is able to locate the kernel, load it into memory, and start its execution

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

SYSGEN program

obtains information concerning the specific configuration of the hardware system such as specific configuration of HW (or probes HW directly), CPU, memory size, available devices, desired options (such as number/size buffers, CPU scheduling algorithm, etc.)

User Goals

operating system should be convenient to use, easy to learn, reliable, safe, and fast

System Goals

operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient

Mode Bit

provided by hardware •Provides ability to distinguish when system is running user code or kernel code •Some instructions designated as privileged, i.e. only executable in kernel mode - such as modify base and limit registers , turn off interrupts, switch from user mode to supervisor mode •System call changes mode to kernel, return from call resets it to user

Compute-server

provides an interface to client to request services (e.g. database)

File-server

provides interface for clients to store and retrieve files thin versus fat clients

Local-Area Network(LAN)

short distance and fast

Networks vary between:

throughput, latency, reliability

Virtual Machines:

•Conceptually, a computer system is made up of layers (from hardware up) •A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware •A virtual machine provides an interface identical to the underlying bare hardware •The operating system creates the illusion of multiple processes...each executing on its own (virtual) processor with its own (virtual) memory •The resources of the physical computer are shared to create the virtual machines -CPU scheduling can create the appearance that user-initiated tasks have their own processor -Spooling and a file system can provide virtual readers and virtual printers -A normal user time-sharing terminal serves as the virtual machine operator's console •Computer system thus consists of an actual computer (hardware) and layers of virtual computers (software)

The operating system is responsible for the following activities in connection with process management:

•Creating and deleting both user and system processes •Suspending and resuming processes •Providing mechanisms for process synchronization •Providing mechanisms for process communication •Providing mechanisms for deadlock handling

I/O Operation

•Device driver loads controller registers appropriately •Controller examines registers, executes I/O •Controller interrupts to signal device driver that I/O completed •Can be high overhead for moving bulk data(i.e. disk I/O)

System programs can be classified as follows:

•File manipulation •Status information •File modification •Programming language support •Program loading and execution •Communications •Application programs

File-System Management:

•Files usually organized into directories •Access control on most systems to determine who can access what •OS activities include (among many) are: Creating and deleting files and directories Primitives to manipulate files and directories Mapping files onto secondary storage Backup files onto stable (non-volatile) storage media

Single-processor systems

•From smartphones to mainframes •Almost all have special-purpose processors for graphics, I/O (generally not considered multiprocessor)

Catching

•Important principle, performed at many levels in a computer (in hardware, operating system, software) •Information in use copied from slower to faster storage temporarily •Faster storage (cache) checked first to determine if information is there •If it is, information used directly from the cache (fast) •If not, data copied to cache and used there •Cache smaller than storage being cached •Cache management important design problem •Cache size and replacement policy

Explain the Layered Approach

•In a layered approach to structuring, the operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. •With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers •Example: Windows NT (i.e. New Technology) -First release had highly-layered organization (with however low performance compared to that of Windows 95) -Windows NT moved layers from user space to kernel space and more closely integrated them

Multi-processor systems(i.e. multiple CPUs)

•Increase throughput...i.e. more work done in less time •Economy of scale - advantage due to size, output, or scale of operation, with cost of output generally decreasing with increasing scale as fixed costs are spread out over more units of output •increased reliability(some are fault tolerant)

Memory Management Activities:

•Keeping track of which parts of memory are currently being used and by what processes •Deciding which processes (or parts thereof) and data to move into and out of memory •Allocating and deallocating memory space as needed

Von-Neumann Architecture

•Load instruction from memory into instruction register •Operands fetched from memory to internal registers •Stores instructions and data in main(or primary) memory •Result may be written back to main memory

Resource Allocator

•Manages all resources (CPU, memory, I/O, etc.) •Resolves conflicting resource requests - for efficient and fair resource use

I/O is subsystem responsible for:

•Memory management of I/O including buffering (storing data temporarily while it is being transferred), caching (storing parts of data in faster storage for performance), spooling (the overlapping of output of one job with input of other jobs) •General device-driver interface (with kernel) •Drivers for specific hardware devices

Modules:

•Most modern operating systems implement kernel modules -Commonly uses object-oriented approach -Each core component is separate -Each talks to the others over/through known interfaces -Each is loadable (as needed) within the kernel •Overall, similar to layers but with more flexibility

Migration of Integer A from Disk to Register:

•Multitasking environments must be careful to use most recent value, no matter where it is stored in the storage hierarchy •Multiprocessor environment must provide cache coherency in hardware such that all CPUs have the most recent value (e.g. of A) in their cache •Distributed environment situation even more complex •Several copies of a datum can exist

System View of a Computer

•OS is the program most involved with the hardware •OS is a resource allocator(manages all resources(CPU,memory,I/O,etc.),and resolves conflicting resource requests) •OS is a control program

System Call Parameter Passing

•Often, more information is required than simply identity of the desired system call •Exact type and amount of information vary according to OS and call •Three general methods used to pass parameters to the OS: •Simplest: pass the parameters in registers •... or parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register -This approach taken by Linux and Solaris •... or parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system •Block and stack methods do not limit the number or length of parameters being passed ... limited though via register approach since may be more parameters than registers

Computer-System operation

•One or more CPUs-device controllers connect through common bus providing access to shared memory •Concurrent execution of CPUs and devices competing for memory cycles

System Boot

•Operating system must be made available to hardware so hardware can start it -Small piece of code - bootstrap loader, locates the kernel, loads it into memory, and starts it -Sometimes two-step process where boot block at fixed location loads bootstrap loader -When power initialized on system, execution starts at a fixed memory location -Firmware used to hold initial boot code

Status Information:

•Some ask the system for info - date, time, amount of available memory, disk space, number of users •Others provide detailed performance, logging, and debugging information •Typically, these programs format and print the output to the terminal or other output devices •Some systems implement a registry (e.g. Microsoft Windows) - used to store and retrieve configuration information

System Calls

•System calls represent the programming interface to the services provided by the OS on behalf of executing programs •Typically written in a high-level language (C or C++) •Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use •Three most common APIs are: Win32 API for Windows, POSIX API for POSIX-based (Portable Operating System Interface for UNIX) systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java Virtual Machine (JVM)

UNIX OS consists of what two separable parts:

•Systems programs •The kernel -Consists of everything below the system-call interface and above the physical hardware -Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level!

File Modification

•Text editors to create and modify files •Special commands to search contents of files or perform transformations of the text

Advantages/Disadvantages of Virtual Machines

•The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. This isolation, however, permits no direct sharing of resources. •A virtual-machine system is a perfect vehicle for operating-systems research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation. •The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine

System Call Implementation

•Typically, a number is associated with each system call (recall traps) -System-call interface maintains a table indexed according to these numbers - pointers then to specific handlers (next slide) •The system-call interface invokes intended system call in OS kernel and returns status of the system call and (possibly) any return values •The caller need know nothing about how the system call is implemented •Just needs to obey API and understand what OS will do as a result call •Most details of OS interface hidden from programmer by API -Managed by run-time support library (set of functions built into libraries included with compiler)

GUI(Graphical User Interface)

•User-friendly desktop metaphor interface •Usually mouse, keyboard, and monitor •Icons represent files, folders, programs, actions, etc •Various mouse buttons over objects in the interface cause various actions: provide information, options, execute function, open directory (known as a folder) •Most systems now include both CLI and GUI interfaces Microsoft Windows •Apple Mac OS X has GUI interface with UNIX kernel underneath and shells available •Solaris is CLI with optional GUI interfaces (Java Desktop, KDE)

Mass-Storage Management:

•Usually disks employed to store what won't fit in memory •Proper management is of central importance •Entire speed of computer operation hinges on disk subsystem and its algorithms •Operating System activities: •Free-space management •Storage allocation •Disk scheduling •Some storage need not be fast •Tertiary storage includes optical storage, magnetic tape •Still must be managed

User View of a Computer

•Varies according to the interface being used •Most Systems designed for one user monopolizing its resources •Multiple users may interface to mainframe or minicomputer •Some users sit at workstations connected to networks of servers •Handheld systems have OS designed for individual usability •Embedded systems designed to run without user intervention

User identities(user IDs, security IDs)

•include name and associated ID number, one per user •User ID then associated with all files, processes of that user to determine access control


Ensembles d'études connexes

chapter 14 part 3 questions and notes

View Set

PrepU Accountability Nursing Concept

View Set

English 2 Honors ethos, pathos and logos definitions

View Set

MKTG 3600 Chapter 7 Activity UVU

View Set

Midterm 2 Material: Topic 4- Gene Interaction, Inheritance and phenotype and Topic 5-

View Set

Football Stars Messi and Ronaldo Audio Bio from http://www.famouspeoplelessons.com/ Glossary in English and Catalan by mnaves3

View Set