+ All Categories
Home > Documents > Chapter 02 - System Structures

Chapter 02 - System Structures

Date post: 15-May-2017
Category:
Upload: norbert-diaz
View: 216 times
Download: 2 times
Share this document with a friend
30
2 LOVELY JOY SANCHEZ CHRISTINE JOY LAMAN SYSTEM STRUCTURES Submitted to: Bryan T. Urita Instructor Operating System Principles Abraham Silberschatz, Peter Baer Galvin and Greg Gagne
Transcript
Page 1: Chapter 02 - System Structures

2LOVELY JOY SANCHEZ

CHRISTINE JOY LAMAN

SYSTEM STRUCTURES

Submitted to: Bryan T. UritaInstructor

Ope

rati

ng S

yste

m P

rinc

iple

sAb

raha

m S

ilber

scha

tz, P

eter

Bae

r Gal

vin

and

Greg

Gag

ne

Page 2: Chapter 02 - System Structures

2.1 Operating-System Services

An operating system provides an environment for the execution of programs.

One set of operating-system services provides functions that are helpful to the user.

User interface. Almost all operating systems have user interface (UI). This interface take several forms.

One is command-line interface (CLI), which uses text commands and a method for entering them (say, a program to allow entering and editing of commands).

Another is batch interface, in which commands and directives to control those commands are entered into files, and those files are executed. Most commonly, a graphical user interface (GUI) is used.

Program execution. The system must be able to load a program into memory and to run that program.

Page 3: Chapter 02 - System Structures

I/O operations. A running program may require I/O, which

may involve a file or an I/O device. File-system manipulation. The file system is of particular

interest. Communications. There are many circumstances in which

one process needs to exchange information with another process.

Error detection. The operating system needs to be constantly aware of possible errors.

Resource allocation. When there are multiple users of multiple jobs running at the same time, resources must be allocated to each of them.

Page 4: Chapter 02 - System Structures

Accounting. We want to keep track of which users use how much and what kinds of computer resources.

Protection and security. The owners of information stored in a multiuser networked computer system may want to control use of that information.

2.2 User Operating-System Interface

There are two fundamental approaches for users to interface with the operating system. On technique is to provide a command-line interface or command interpreter that allows users to directly enter commands that are to be performed by the operating system. The second approach allows the user to interface with the operating system via a graphical user interface or GUI.

Page 5: Chapter 02 - System Structures

2.2.1 Command InterpreterThe main function of the command interpreter is to get and

execute the next user-specified command.There are two general ways in which these commands can

be implemented.In one approach, the command interpreter itself contains

the code to execute the command.An alternative approach – used by UNIX, among the other

operating systems – implements most commands through system programs. The INIX command to delete a file

rm file.txt

2.2.2 Graphical User Interfaces

A GUI provides a desktop metaphor where the mouse is moved to position its pointer on images, or icons, on the screen (the desktop) that represent programs, files, directories, and system functions. Depending on the mouse pointer’s location,

Page 6: Chapter 02 - System Structures

clicking a button on the mouse can invoke program, select a file or directory – known as a folder – or pull down a menu that contains commands.

2.3 System Calls

System calls provide an interface to the services made available by an operating system. The se calls are generally available as routines written in C and C++, although certain low-level tasks (for example, tasks where hardware must be accessed directly), may need to be written using assembly-language instructions.

Page 7: Chapter 02 - System Structures

Figure 2.1 Example of how system calls are used.

source file destination file

Example System Call Sequence

Acquire input file name Write prompt to screen Accept input Acquire output file name Write prompt to screen Accept input Open the input file if file doesn’t exist, abort Create output file if file exist, abort Loop Read from input file Write output file Until read fails Close output file Write completion message to screen Terminate normally

Page 8: Chapter 02 - System Structures

Figure 2.2 The handling of a user application invoking the open() system call.

user application

system call interface

• • •

• • •

open ( )

usermodekernelmode

i

open ( )

Implementationof open ( )system call• • • return

Page 9: Chapter 02 - System Structures

Figure 2.3 Passing of parameters as the table.

X: parameters

for call

load address X

system call 13

X

use parametersfrom table X

register

code for

systemcall 13

Page 10: Chapter 02 - System Structures

2.4 Types of System Calls

System calls can be grouped roughly into five major categories: process control, file manipulation, device manipulation, information maintenance, and communications.

Figure 2.4 Types of system calls.

• Process controlo end, aborto load, executeo create process, terminate processo get process attributes, set process attributeso wait for timeo wait event, signal evento allocate and free memory

Page 11: Chapter 02 - System Structures

• File Managemento create file, delete fileo open, closeo read, write, repositiono get file attributes, set file attributes• Device Management

o request device, release deviceo read, write, repositiono get device attributes, set device attributeso logically attach or detach devices• Information Maintenance

o get time or date, set time or dateo get system data, set system datao get process, file, or device attributeso set process, file, or device attributes

Page 12: Chapter 02 - System Structures

•Communicationso create, delete communication connectiono send, receive messageso transfer status informationo attach or detach remote devices

2. 4.1 Process Control

A running program needs to be able to halt its execution either normally (end) or abnormally (abort).* Debugger – a system program designed to aid the programmer in finding and correcting bugs – to determine the cause of the problem.* A control card is a batch system concept. It is a command to manage the execution of a process.

Page 13: Chapter 02 - System Structures

Figure 2.5 MS-DOS execution.(a) At system startup.(b) Running a program.

free memory

command interpret

erkernel kernel

Free memory

process

commandinterpreter

(b) (a)

free memory

process D

process C

interpreter

process B

kernel

Figure 2.6 FreeBSD running multiple programs.

Page 14: Chapter 02 - System Structures

2.4.2 File Management

We first need to be able to create and delete files. Either system call requires the name of the file and perhaps some of the file’s attributes. Once the file is created, we need to open it and to use it. We may also read, write, or reposition.

2.4.3 Device Management

A process may nee several resources to execute – main memory, disk drives, access to files, and so on.

2.4.4 Information Maintenance

Many system calls exist simply for the purpose of transferring information between the user program and the operating system.

Page 15: Chapter 02 - System Structures

2.4.5 Communication

There are two common models of interprocess communication: the message-passing model and the shared-memory model.• Message-passing model – the communicating process

exchange message with one another to transfer information.• Shared-memory model – processes use shared memory create and shared memory attach system calls to create and gain access to regions of memory owned by other processes.

2.5 System ProgramsCategories:• File management• Status information• File modification

Page 16: Chapter 02 - System Structures

• Programming-language support• Program loading and execution• Communications

• System utilities or Application programs – programs include web browsers, word processors and text formatters, spreadsheets, data base systems, compliers, plotting and statistical-analysis packages, and games.

2.6 Operating-System Design and Implementation

Problems we face in designing and implementing an operating system.

Page 17: Chapter 02 - System Structures

2.6.1 Design goals

The first problem in designing a system is to define goals and specifications. At the highest level, the design of the system will be affected by the choice of hardware and the type of system: batch, time shared, single user, multiuser, distributed, real time, or general purposes.

2.6.2 Mechanisms and Policies

One important principle is the separation of policy from mechanism. Mechanism s determine how to d something; policies determine what will be done.

2.6.3 Implementation

Once an operating system is designed, it must be implemented. Traditionally, operating systems have been written in assembly language. Now, however, they are most commonly written in

Page 18: Chapter 02 - System Structures

higher –level languages such as C or C++.

2.7 Operating-System Structure

A system as large and complex as a modern operating system must be engineered carefully if it is to function properly and be modified easily.

2.7.1 Simple Structure

Operating systems started as small, simple, and limited systems and then grew beyond their original scope. MS-DOS is an example of such system. It was originally designed and implemented b a few people who had no idea that it would become so popular. It was written to provide the most functionality in

Page 19: Chapter 02 - System Structures

Figure 2.7 MS-DOS layer structure

application program

resident system program

MS-DOS device drivers

ROM BIOS device drivers

Page 20: Chapter 02 - System Structures

2.7.2 Layered Approach

With proper hardware support, operating systems can be broken into pieces that are smaller and more appropriate than those allowed by the original MS-DOS or UNIX systems.

(the users)shells and commands

compilers and interpreterssystem libraries

system-call interface to the kernelsignals terminal

handlingcharacter I/O

systemterminal drivers

file systemswapping block I/O

systemdisk and tape

drivers

CPU schedulingpage

replacementdemand pagingvirtual memory

kernel interface to the hardwareterminal controllers

terminalsdevice controllersdisks and tapes

memory controllers

physical memoryFigure 2.8 UNIX system structure.

Page 21: Chapter 02 - System Structures

Figure 2.9 A layered operating system.

layer Nuser

interface• • •

layer 1

layer 0hardware

Page 22: Chapter 02 - System Structures

2.7.3 Microkernels

We have already seen that as UNIX expanded, the kernel became large and difficult to manage. In the mid-1980’s, researchers at Carnegie Mellon University developed an operating system called March that modularized the kernel using the microkernel approach.

2.7.4 Modules

Perhaps the best current methodology for operating-system design involves using object-oriented programming techniques to create a modular kernel. The Solaris operating system structure is organized around a core kernel with seven types of loadable kernel with seven types of loadable kernel modules:1. Scheduling classes5. STREAMS modules2. File systems 6. Miscellaneous3. Loadable system calls 7. Device and bus drivers4. Executable formats

Page 23: Chapter 02 - System Structures

Figure 2.10 Solaris loadable modules.

file systems

scheduling

classesdevice

and bus drivers

Miscellan-eous

modulas

STREAMS modules

executable formats

loadable system

calls

core Solaris kernel

Page 24: Chapter 02 - System Structures

Figure 2.11 The Mac OS X structure.

application environments and common services

BSD

March

kernelenvironment

2.8 Virtual MachinesThe fundamental idea behind a virtual machine is to abstract the hardware of a single computer (the CPU, memory, disk drivers, network interface cards, and so forth) into several different

Page 25: Chapter 02 - System Structures

executions environments, thereby creating the illusion that each separate execution environment is running its own private computer.

processes

Figure 2.12 System models. (a) nonvirtual machine. (b) Virtual machine.

(a)

hardwarekernel

processesprocesses

processes

kernel kernel kernelVM 1 VM 1 VM 1

virtual-machineimplementation

hardware

(b)

Page 26: Chapter 02 - System Structures

2.8.1 Implementation

Although the virtual-machine concept is useful, it is difficult to implement. Much work is required to provide an exact duplicate of the underlying machine.

2.8.1 Benefits

The virtual-machine concept has several advantages. Each virtual machine is completely isolated from all other virtual machines, so there are no protection problems.

2.8.3 Examples

Despite the advantages of virtual machines, they received little attention for a number of years after they were first developed. Virtual machines are coming back into fashion as means of solving system compatibility problems.

Page 27: Chapter 02 - System Structures

2.8.3.1 Vmware

Vmware is a popular commercial application that abstracts Intel 80X86 hardware into isolated virtual machines. application application application application

guest operating system

(free BSD)

virtual CPUvirtual memoryvirtual devices

guest operating system

(Windows NT)

virtual CPUvirtual memoryvirtual devices

guest operating system

(Windows XP)

virtual CPUvirtual memoryvirtual devices

virtualization layer

host operating system(Linux)

hardwareCPU memory I/O devices

Figure 2.13 Vmware architecture.

Page 28: Chapter 02 - System Structures

2.8.3.2 The Java Virtual Machine

Java is a popular object-oriented programming language introduced be Sun Microsystems in 1995. In addition to a language specification for a Java virtual machine-or JVM.

Java program class files

class loader

Java interpret

er

host system(Windows, Linux,

etc.)

Figure 2.14 The Java virtual machine.

Java APIclass files

Page 29: Chapter 02 - System Structures

2.9 Operating-System Generation

It is possible to design, code, and implement an operating system specifically for one machine at one site. The system must then be configured or generated for each specific computer site, a process sometimes known as system generation (SYSGEN).

2.10 System Boot

After an operating system is generated, it must be made available for use by the hardware. The procedure of starting a computer by loading the kernel in known as booting the system. On most computer systems, a small piece of code known as the bootstrap program or bootstrap loader locates the kernel, loads it into main memory, and starts its execution.

Page 30: Chapter 02 - System Structures

*Read-Only Memory (ROM) – it needs no initialization and cannot be infected by a computer virus.

*Erasable Programmable Read-Only Memory (EPROM) – read only except when explicitly given a command to become writable.

*All forms of ROM are also known as firmware.

*A disk that has a boot partition is called a boot disk or system disk.


Recommended