+ All Categories
Home > Documents > System Software Nizamettin AYDIN [email protected] naydin.

System Software Nizamettin AYDIN [email protected] naydin.

Date post: 21-Jan-2016
Category:
Upload: clyde-wilkinson
View: 223 times
Download: 0 times
Share this document with a friend
Popular Tags:
92
System Software Nizamettin AYDIN naydin@y ildiz .edu.tr http://www.yildiz.edu.tr/~naydin
Transcript
Page 1: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

System Software

Nizamettin [email protected]

http://www.yildiz.edu.tr/~naydin

Page 2: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

2

Bilgisayar Donanımı

System Software

Page 3: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

3

Introduction

• The biggest and fastest computer in the world is of no use if it cannot efficiently provide beneficial services to its users.

• Users see the computer through their application programs. These programs are ultimately executed by computer hardware.

• System software-- in the form of operating systems and middleware-- is the glue that holds everything together.

Page 4: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

4

Operating Systems - Objectives and Functions

• Convenience—An operating system makes a computer easier

to use

• Efficiency—An operating system allows better use of

computer resources

Page 5: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

5

Layers and Views of a Computer System

Page 6: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

6

Operating System Services

• Program creation• Program execution• Access to I/O devices• Controlled access to files• System access• Error detection and response• Accounting

Page 7: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

7

O/S as a Resource Manager

• A computer is a set of resources for the movement, storage, and processing of data and for the control of these functions

• The O/S is responsible for managing these resources

• O/S is a program executed by the processor

• The O/S frequently relinquishes control and must depend on the processor to allow it to regain control

Page 8: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

8

Main Resources managed by the O/S

Page 9: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

9

Types of Operating System

• Interactive—User/programmer interacts directly with the

computer through a keyboard/display terminal

• Batch—Opposite of interactive. Rare

• Single program (Uni-programming)—Works only one program at atime

• Multi-programming (Multi-tasking)—Processor works on more than one program at

a time

Page 10: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

10

Early Systems

• Late 1940s to mid 1950s—No Operating System—Programs interact directly with hardware

• Two main problems:—Scheduling: —Setup time

Page 11: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

11

Simple Batch Systems

• Resident Monitor program• Users submit jobs to operator• Operator batches jobs• Monitor controls sequence of events to

process batch• When one job is finished, control returns

to Monitor which reads next job• Monitor handles scheduling

Page 12: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

12

Memory Layout for Resident Monitor

Page 13: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

13

Multi-programmed Batch Systems

• I/O devices very slow• When one program is waiting for I/O,

another can use the CPU

Page 14: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

14

Multi-programmed Batch Systems

• Following illustrates the problem: —The calculation concerns a program that processes a

file of records —and performs, on average, 100 processor instructions

per record.

• In this example the computer spends over 96% of its time waiting for I/O devices to finish transferring data.

System utilization example

Page 15: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

15

Single Program

Page 16: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

16

Multi-Programming with Two Programs

Page 17: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

17

Multi-Programming with Three Programs

Page 18: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

18

Example- benefits of mutiprogramming

• Consider a computer with 250 MBytes of memory, a disk, a terminal, and a printer. —Three programs, JOB1, JOB2, and JOB3, are submitted for

execution at the same time with the following attributes:

• We assume minimal processor requirements for JOB2 and JOB3, and continuous disk and printer use by JOB3.

• For a simple batch environment, these jobs will be executed in sequence

Page 19: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

19

Utilization histograms

Page 20: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

20

Effects of Multiprogramming on Resource Utilization

Page 21: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

21

Operating Systems

• The evolution of operating systems has paralleled the evolution of computer hardware.—As hardware became more powerful, operating

systems allowed people to more easily manage the power of the machine.

• In the days when main memory was measured in kilobytes, and tape drives were the only form of magnetic storage, operating systems were simple resident monitor programs.—The resident monitor could only load, execute,

and terminate programs.

Page 22: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

22

Operating Systems

• In the 1960s, hardware has become powerful enough to accommodate multiprogramming,

—the concurrent execution of more than one task.

• Multiprogramming is achieved by allocating each process a given portion of CPU time (a timeslice).

• Interactive multiprogramming systems were called timesharing systems.—When a process is taken from the CPU and

replaced by another, we say that a context switch has occurred.

Page 23: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

23

Operating Systems

• Today, multiprocessor systems have become commonplace. —They present an array of challenges to the

operating system designer, – including the manner in which the processors will be

synchronized, – and how to keep their activities from interfering with

each other.

• Tightly coupled multiprocessor systems share a common memory and the same set of I/O devices.—Symmetric multiprocessor systems are tightly

coupled and load balanced.

Page 24: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

24

Operating Systems

• Loosely coupled multiprocessor systems have physically separate memory. —These are often called distributed systems.—Another type of distributed system is a

networked system, which consists of a collection of interconnected, collaborating workstations.

• Real time operating systems control computers that respond to their environment.—Hard real time systems have tight timing

constraints, soft real time systems do not.

Page 25: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

25

Operating Systems

• Personal computer operating systems are designed for ease of use rather than high performance.

• The idea that revolutionized small computer operating systems was the BIOS

—(basic input-output operating system) chip that permitted a single operating system to function on different types of small systems.

—The BIOS takes care of the details involved in addressing divergent peripheral device designs and protocols.

Page 26: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

26

Operating Systems

• Operating systems having graphical user interfaces were first brought to market in the 1980s.

• At one time, these systems were considered appropriate only for desktop publishing and games.

• Today they are seen as technology enablers for users with little formal computer education.

• Once solely a server operating system, Linux holds the promise of bringing Unix to ordinary desktop systems.

Page 27: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

27

Operating Systems

• Two operating system components are crucial: —The kernel

—and the system programs.

• As the core of the operating system, the kernel performs – scheduling,

– synchronization,

– memory management,

– interrupt handling

– and it provides security and protection.

• Microkernel systems provide minimal functionality, with most services carried out by external programs.

• Monolithic systems provide most of their services within a single operating system program.

Page 28: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

28

Operating Systems

• Microkernel systems provide better security, easier maintenance, and portability at the expense of execution speed.—Examples are Windows 2000, Mach, and QNX.—Symmetric multiprocessor computers are ideal

platforms for microkernel operating systems.

• Monolithic systems give faster execution speed, but are difficult to port from one architecture to another.—Examples are Linux, MacOS, and DOS.

Page 29: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

29

Operating Systems

• Process management lies at the heart of operating system services.—The operating system creates processes,

schedules their access to resources, deletes processes, and deallocates resources that were allocated during process execution.

• The operating system monitors the activities of each process to avoid synchronization problems that can occur when processes use shared resources.

• If processes need to communicate with one another, the operating system provides the services.

Page 30: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

30

Operating Systems

• The operating system schedules process execution.• First, the operating system determines which process

shall be granted access to the CPU.—This is long-term scheduling.

• After a number of processes have been admitted, the operating system determines which one will have access to the CPU at any particular moment.—This is short-term scheduling.

• Context switches occur when a process is taken from the CPU and replaced by another process.—Information relating to the state of the process

is preserved during a context switch.

Page 31: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

31

Scheduling

• Scheduling is key to multi-programming• A process is:

—A program in execution—The “animated spirit” of a program—That entity to which a processor is assigned

• Types of scheduling:

Page 32: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

32

Long Term Scheduling

• Determines which programs are submitted for processing

• i.e. controls the degree of multi-programming

• Once submitted, a job becomes a process for the short term scheduler

• (or it becomes a swapped out job for the medium term scheduler)

Page 33: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

33

Medium Term Scheduling

• Part of the swapping function• Usually based on the need to manage

multi-programming• If no virtual memory, memory

management is also an issue

Page 34: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

34

Short Term Scheduler

• Also known as Dispatcher, executes frequently and makes the fine grained decisions of which job to execute next

• i.e. which job actually gets to use the processor in the next time slot

• 5 define states in a process state: —New: A program is admitted by the high-level

schedular but is not yet ready to execute—Ready: The process is ready to execute—Running: The prcess is being executed—Waiting: The process is suspended, waiting for

some system resources—Halted: The process has terminated and will be

destroyed by the O/S.

Page 35: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

35

Five State Process Model

Page 36: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

36

Process Control Block

• Identifier• State• Priority• Program counter• Memory pointers• Context data• I/O status• Accounting

information

Page 37: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

37

Scheduling Example

Page 38: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

38

Key Elements of O/S for Multiprogramming

Page 39: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

39

Queuing Diagram Representation of Process Scheduling

Page 40: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

40

Operating Systems

• Four approaches to CPU scheduling are:—First-come, first-served where jobs are serviced

in arrival sequence and run to completion if they have all of the resources they need.

—Shortest job first where the smallest jobs get scheduled first. (The trouble is in knowing which jobs are shortest!)

—Round robin scheduling where each job is allotted a certain amount of CPU time. A context switch occurs when the time expires.

—Priority scheduling preempts a job with a lower priority when a higher-priority job needs the CPU.

Page 41: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

41

Programming Tools

• Programming tools carry out the mechanics of software creation within the confines of the operating system and hardware environment.

• Assemblers are the simplest of all programming tools. They translate mnemonic instructions to machine code.

• Most assemblers carry out this translation in two passes over the source code. —The first pass partially assembles the code and

builds the symbol table—The second pass completes the instructions by

supplying values stored in the symbol table.

Page 42: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

42

Programming Tools

• The output of most assemblers is a stream of relocatable binary code.—In relocatable code, operand addresses are relative

to where the operating system chooses to load the program.

—Absolute (nonrelocatable) code is most suitable for device and operating system control programming.

• When relocatable code is loaded for execution, special registers provide the base addressing.

• Addresses specified within the program are interpreted as offsets from the base address.

Page 43: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

43

Programming Tools

• The process of assigning physical addresses to program variables is called binding.

• Binding can occur at compile time, load time, or run time.

• Compile time binding gives us absolute code.

• Load time binding assigns physical addresses as the program is loaded into memory.—With load time, binding the program cannot be

moved!

• Run time binding requires a base register to carry out the address mapping.

Page 44: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

44 “BLGM5519” “BİLGİSAYAR DONANIMI” “BAHÇEŞEHİR ÜNİVERSİTESİ” “GÜZ 2008” “Dr. N AYDIN”

Programming Tools

• On most systems, binary instructions must pass through a link editor (or linker) to create an executable module.

• Link editors incorporate various binary routines into a single executable file as called for by a program’s external symbols.

• Like assemblers, link editors perform two passes: The first pass creates a symbol table and the second resolves references to the values in the symbol table.

Page 45: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

45

Programming Tools

Page 46: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

46

Programming Tools

• Dynamic linking is when the link editing is delayed until load time or at run time.

• External modules are loaded from dynamic link libraries (DLLs).

• Load time dynamic linking slows down program loading, but calls to the DLLs are faster.

• Run time dynamic linking occurs when an external module is first called, causing slower execution time.—Dynamic linking makes program modules

smaller, but carries the risk that the programmer may not have control over the DLL.

Page 47: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

47

Programming Tools

• Assembly language is considered a “second generation” programming language (2GL).

• Compiled programming languages, such as C, C++, Pascal, and COBOL, are “third generation” languages (3GLs).

• Each language generation presents problem solving tools that are closer to how people think and farther away from how the machine implements the solution.

Page 48: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

48

Programming Tools

Keep in mind that the computer can understand only the 1GL!

Page 49: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

49

Programming Tools

• Compilers bridge the semantic gap between the higher level language and the machine’s binary instructions.

• Most compilers effect this translation in a six-phase process. The first three are analysis phases:

1. Lexical analysis extracts tokens, e.g., reserved words and variables.

2. Syntax analysis (parsing) checks statement construction.

3. Semantic analysis checks data types and the validity of operators.

Page 50: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

50

Programming Tools

• The last three compiler phases are synthesis phases:4. Intermediate code generation creates three

address code to facilitate optimization and translation.

5. Optimization creates assembly code while taking into account architectural features that can make the code efficient.

6. Code generation creates binary code from the optimized assembly code.

• Through this modularity, compilers can be written for various platforms by rewriting only the last two phases.

Page 51: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

51

Programming Tools

Page 52: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

52

Programming Tools

• Interpreters produce executable code from source code in real time, one line at a time.

• Consequently, this not only makes interpreted languages slower than compiled languages but it also affords less opportunity for error checking.

• Interpreted languages are, however, very useful for teaching programming concepts, because feedback is nearly instantaneous, and performance is rarely a concern.

Page 53: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

53

Java: All of the Above

• The Java programming language exemplifies many of the concepts that we have discussed in this chapter.

• Java programs (classes) execute within a virtual machine, the Java Virtual Machine (JVM).

• This allows the language to run on any platform for which a virtual machine environment has been written.

• Java is both a compiled and an interpreted language. The output of the compilation process is an assembly-like intermediate code (bytecode) that is interpreted by the JVM.

Page 54: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

54

Java: All of the Above

• The JVM is an operating system in miniature. —It loads programs, links them, starts execution

threads, manages program resources, and deallocates resources when the programs terminate.

• Because the JVM performs so many tasks at run time, its performance cannot match the performance of a traditional compiled language.

Page 55: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

55

Database Software

• Database systems contain the most valuable assets of an enterprise. They are the foundation upon which application systems are built.

Page 56: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

56

Database Software

• Database systems provide a single definition, the database schema, for the data elements that are accessed by application programs.

—A physical schema is the computer’s view of the database that includes locations of physical files and indexes.

—A logical schema is the application program’s view of the database that defines field sizes and data types.

• Within the logical schema, certain data fields are designated as record keys that provide efficient access to records in the database.

Page 57: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

57

Database Software

• Keys are stored in physical index file structures containing pointers to the location of the physical records.

• Many implementations use a variant of a B+ tree for index management because B+ trees can be optimized with consideration to the I/O system and the applications.

• In many cases, the “higher” nodes of the tree will persist in cache memory, requiring physical disk accesses only when traversing the lower levels of the index.

Page 58: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

58

Database Software

• Most database systems also include transaction management components to assure that the database is always in a consistent state.

• Transaction management provides the following properties:—Atomicity - All related updates occur or no updates occur.—Consistency - All updates conform to defined data

constraints.— Isolation - No transaction can interfere with another

transaction.—Durability - Successful updates are written to durable

media as soon as possible.

• These are the ACID properties of transaction management.

Page 59: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

59

Database Software

• Without the ACID properties, race conditions can occur:

Page 60: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

60

Database Software

• Record locking mechanisms assure isolated, atomic database updates:

Page 61: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

61

Transaction Managers

• One way to improve database performance is to ask it to do less work by moving some of its functions to specialized software.

• Transaction management is one component that is often partitioned from the core database system.

• Transaction managers are especially important when the transactions involve more than one physical database, or the application system spans more than one class of computer, as in a multitiered architecture.

• One of the most widely-used transaction management systems is CICS shown on the next slide.

Page 62: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

62

Transaction Managers

Page 63: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

63

• The proper functioning and performance of a computer system depends as much on its software as its hardware.

• The operating system is the system software component upon which all other software rests.

• Operating systems control process execution, resource management, protection, and security.

• Subsystems and partitions provide compatibility and ease of management.

Conclusion

Page 64: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

64

• Programming languages are often classed into generations, with assembly language being the first generation.

• All languages above the machine level must be translated into machine code.

• Compilers bridge this semantic gap through a series of six steps.

• Link editors resolve system calls and external routines, creating a unified executable module.

Conclusion

Page 65: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

65

• The Java programming language incorporates the idea of a virtual machine, a compiler and an interpreter.

• Database software provides controlled access to data files through enforcement of ACID properties.

• Transaction managers provide high performance and cross-platform access to data.

Conclusion

Page 66: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

66

Memory Management

Page 67: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

67

Memory Management

• Task of dynamically subdivison of memory• Effective memory management is vital in a

multiprogramming system• Uni-program

—Memory split into two—One for Operating System (monitor)—One for currently executing program

• Multi-program—“User” part is sub-divided and shared among

active processes

Page 68: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

68

Swapping

• Problem: I/O is so slow compared with CPU that even in multi-programming system, CPU can be idle most of the time

• Solutions:—Increase main memory

– Expensive– Leads to larger programs

—Swapping

Page 69: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

69

What is Swapping?

• Long term queue of processes stored on disk• Processes “swapped” in as space becomes

available• As a process completes it is moved out of

main memory• If none of the processes in memory are ready

(i.e. all I/O blocked)—Swap out a blocked process to intermediate

queue—Swap in a ready process or a new process—But swapping is an I/O process…

Page 70: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

70

Use of Swapping

Page 71: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

71

Partitioning

• Splitting memory into sections to allocate to processes (including Operating System)

• Fixed-sized partitions—May not be equal size—Process is fitted into smallest hole that will

take it (best fit)—Some wasted memory—Leads to variable sized partitions

Page 72: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

72

Fixed Partitioning

Page 73: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

73

Variable Sized Partitions (1)

• Allocate exactly the required memory to a process

• This leads to a hole at the end of memory, too small to use—Only one small hole - less waste

• When all processes are blocked, swap out a process and bring in another

• New process may be smaller than swapped out process

• Another hole

Page 74: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

74

Variable Sized Partitions (2)

• Eventually have lots of holes (fragmentation)

• Solutions:—Coalesce - Join adjacent holes into one large

hole—Compaction - From time to time go through

memory and move all hole into one free block (c.f. disk de-fragmentation)

Page 75: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

75

Effect of Dynamic Partitioning

Page 76: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

76

Relocation

• No guarantee that process will load into the same place in memory

• Instructions contain addresses—Locations of data—Addresses for instructions (branching)

• Logical address - relative to beginning of program

• Physical address - actual location in memory (this time)

• Automatic conversion using base address

Page 77: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

77

Paging

• Split memory into equal sized, small chunks -page frames

• Split programs (processes) into equal sized small chunks - pages

• Allocate the required number page frames to a process

• Operating System maintains list of free frames

• A process does not require contiguous page frames

• Use page table to keep track

Page 78: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

78

Allocation of Free Frames

Page 79: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

79

Logical and Physical Addresses - Paging

Page 80: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

80

Virtual Memory

• Demand paging—Do not require all pages of a process in

memory—Bring in pages as required

• Page fault—Required page is not in memory—Operating System must swap in required page—May need to swap out a page to make space—Select page to throw out based on recent

history

Page 81: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

81

Thrashing

• Too many processes in too little memory• Operating System spends all its time

swapping• Little or no real work is done• Disk light is on all the time

• Solutions—Good page replacement algorithms—Reduce number of processes running—Fit more memory

Page 82: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

82

Bonus

• We do not need all of a process in memory for it to run

• We can swap in pages as required• So - we can now run processes that are

bigger than total memory available!

• Main memory is called real memory• User/programmer sees much bigger

memory - virtual memory

Page 83: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

83

Segmentation

• Paging is not (usually) visible to the programmer

• Segmentation is visible to the programmer

• Usually different segments allocated to program and data

• May be a number of program and data segments

Page 84: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

84

Advantages of Segmentation

• Simplifies handling of growing data structures

• Allows programs to be altered and recompiled independently, without re-linking and re-loading

• Lends itself to sharing among processes• Lends itself to protection• Some systems combine segmentation

with paging

Page 85: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

85

Pentium II

• Hardware for segmentation and paging• Unsegmented unpaged

— virtual address = physical address— Low complexity— High performance

• Unsegmented paged— Memory viewed as paged linear address space— Protection and management via paging— Berkeley UNIX

• Segmented unpaged— Collection of local address spaces— Protection to single byte level— Translation table needed is on chip when segment is in memory

• Segmented paged— Segmentation used to define logical memory partitions subject to

access control— Paging manages allocation of memory within partitions— Unix System V

Page 86: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

86

Pentium II Address Translation Mechanism

Page 87: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

87

Pentium II Segmentation

• Each virtual address is 16-bit segment and 32-bit offset

• 2 bits of segment are protection mechanism

• 14 bits specify segment• Unsegmented virtual memory 232 =

4Gbytes• Segmented 246=64 terabytes

—Can be larger – depends on which process is active

—Half (8K segments of 4Gbytes) is global—Half is local and distinct for each process

Page 88: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

88

Pentium II Protection

• Protection bits give 4 levels of privilege—0 most protected, 3 least—Use of levels software dependent—Usually level 3 for applications, level 1 for O/S

and level 0 for kernel (level 2 not used)—Level 2 may be used for apps that have

internal security e.g. database—Some instructions only work in level 0

Page 89: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

89

Pentium II Paging

• Segmentation may be disabled—In which case linear address space is used

• Two level page table lookup—First, page directory

– 1024 entries max– Splits 4G linear memory into 1024 page groups of

4Mbyte– Each page table has 1024 entries corresponding to

4Kbyte pages– Can use one page directory for all processes, one per

process or mixture– Page directory for current process always in memory

—Use TLB holding 32 page table entries—Two page sizes available 4k or 4M

Page 90: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

90

PowerPC Memory Management Hardware

• 32 bit – paging with simple segmentation—64 bit paging with more powerful segmentation

• Or, both do block address translation—Map 4 large blocks of instructions & 4 of

memory to bypass paging—e.g. OS tables or graphics frame buffers

• 32 bit effective address—12 bit byte selector

– =4kbyte pages

—16 bit page id– 64k pages per segment

—4 bits indicate one of 16 segment registers– Segment registers under OS control

Page 91: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

91

PowerPC 32-bit Memory Management Formats

Page 92: System Software Nizamettin AYDIN naydin@yildiz.edu.tr naydin.

92

PowerPC 32-bit Address Translation


Recommended