Computer Hardware and System Software Concepts

Size: px
Start display at page:

Download "Computer Hardware and System Software Concepts"

Transcription

1 Computer Hardware and System Software Concepts Introduction to concepts of System Software/Operating System Welcome to this course on Computer Hardware and System Software Concepts 1

2 RoadMap Introduction to the Concepts of System Software Introduction to Operating System/Memory Management 2 Day2 Recap of Day1 Introduce System Software To discuss about the following Assemblers Loaders Linkers Compilers To introduce Operating Systems/Memory Management To discuss about the following Operating System Functions of Operating System Memory Management Memory Management Schemes 2

3 System Software System programs which provide a more convenient environment for program development and execution Example Compilers Assemblers Loaders Linkers Operating System 3 Motivate, once again, what is the difference application and systems software. 3

4 Translators A program which converts a user s program written in some language to another language. The language in which the user s program is written is called the source language The language to which the source language is converted is called the target language 4 Motivate for translators: If there is a processor that can directly execute programs written in the source language, then, there is no need to translate the source program into the target language. Translation is thus used only when a processor is available for the target language but not for the source language. Running the translated program will give exactly the same result as the execution of the same program would have given had the processor for it was available. i.e. of course if the translation was done correctly. Example: Compilers, Assemblers etc There is an important difference between translation and interpretation. In the former, the original program is first converted to an equivalent program called an object program. Then this object program is executed i.e. only after the translation has been completed. Hence, the original program in the source language is not directly executed. Thus, translation comprises of two steps i.e 1. Generation of an equivalent program in target language 2. Execution of the generated program Interpretation consists of only one step i.e. executing the original source program 4

5 Translators Source Program Target Program 5 5

6 Translator Source Program (High level language) Compiler Target Program (Object /Exe code ) 6 When a source program is a high level language such as COBOL and the target program is a numerical machine language then the translator is called as a compiler. 6

7 Translator Source Program (Assembly language) Assembler Target Program (Machine language ) 7 When a source program is a assembly language and the target program is a numerical machine language then the translator is called as a assembler. Assembly language is basically a symbolic representation for a numerical machine language 7

8 Assembly language A convenient language using mnemonics (symbolic names and symbolic addresses) for coding machine instructions The assembly programmer has access to all the features and instructions available on the target machine and thus can execute every instruction in the instruction set of the target machine 8 Some other characteristics: Assembly language programming is difficult Takes longer time Takes longer to debug Difficult to maintain Why go for assembly language programming? 1. Performance issues For some applications, speed and size of the code are critical. An expert assembly language programmer can often produce code that is much smaller and much faster than a high level programmer can. Example embedded applications such as the code on a smart card, the code in a cellular telephone, BIOS routines, inner loops of performance critical applications etc. 2. Access to the machine Some procedures need complete access to the hardware, something which is impossible in high level languages. Example low level interrupt and trap handlers in an operating system etc. 8

9 Assembly language (Example) Consider the computation of a formula N=I+J illustrated using instructions from Motorola Label OPCODE OPERANDS COMMENT TEMP : MOVE.L I, D0 ; Load I into Reg D0 ADD.L J, D0 ; ADD J to D0 MOVE.L D0,N ; Store I+J in N I: DC.L 3 ; Reserve 4 bytes initialized to 3; J: DC.L 3 ; Reserve 4 bytes initialized to 3; N: DC.L 0 ; Reserve 4 bytes initialized to 0; 9 Assembly language format: The format of a typical assembly language program consists of Label field provides symbolic names for memory addresses which is needed on executable statements so that the statements can be jumped to. It also permits the data stored there to be accessible by the symbolic name. Example: TEMP,FORMUL etc Operation field contains a symbolic abbreviation for the opcode or a pseudo-instruction. Example: MOVE, ADD etc. Operands field specifies addresses or registers used by operands of the machine instruction. Example: D0,R1,R2 etc. Comment field is used for documentation purposes. Explanation of the example in the slide above: TEMP : It is a label field MOVE : An instruction that moves the first arg to second arg ADD : Adds the contents of first arg to second arg and stores it in the second arg I : Yet another label DC (Define Constant) is a pseudo instruction which is a command to the assembler to interpret it. The suffix.l denotes long (i.e. 4 bytes) associated with that opcode. In the above example one important point is worth noting. How does the assembler know what is stored in a location N. such a reference which is used even before it is defined is called a forward reference(next slide). 9

10 Assembly language (The Forward Reference) is a reference which is used even before it is defined Can be handled in two ways: Two pass assembler One pass assembler 10 Each reading of the source program is called a pass. Any translator which reads the input program once is called a one-pass assembler and if it reads twice is called a two-pass assembler. Two - pass assembler: 1. In pass-one of a two-pass assembler, the definitions of symbols, statement labels etc are collected and stored in a table known as the symbol table. 2. In pass-two, each statement can be read, assembled and output as the values of all symbols are known. This approach is thus quite simple though it requires an additional pass. One - pass assembler: The assembly program is read once and converted to an intermediate form and thereafter stored in a table in memory 10

11 Loaders Are system programs Loads the binary code in memory (main) Transfer the control to 1st instruction 11 There are various loading schemes: 1. Assemble-and-go loader: The assembler simply places the code into memory and the loader executes a single instruction that transfers control to the starting instruction of the assembled program. In this scheme, some portion of the memory is used by the assembler itself which would otherwise have been available for the object program. 2. Absolute loader: Object code must be loaded into the absolute addresses in the memory to run. If there are multiple subroutines, then each absolute address has to be specified explicitly. 3. Relocating loader: This loader modifies the actual instructions of the program during the process of loading a program so that the effect of the load address is taken into account. 11

12 Linkers Are system programs that accounts for and reconciles all address references within and among modules. Example Large Program main sort search count 12 In actual practice, a complete program is built from many smaller routines possibly by many people. All these routines have to be connected logically and linked to form a single program. A linker is a systems program that accounts for and reconciles all address references within and among modules and replaces those references with a single consistent scheme of relative addresses. Linking is done after the code is generated and is closely associated with a loader. Compilers and translators basically translate one procedure at a time and put the translated output on the disk. All the translated procedures have to be located and linked together to be run as a unit called an executable binary program. In MS-DOS, Windows 95/98 etc object modules have extension.obj and the executable binary programs have.exe extension. In UNIX, object modules have.o extension and executable programs have no extension. Linking is of two main types: 1. Static Linking: All references are resolved during loading at linkage time 2. Dynamic Linking: References made to the code in the external module are resolved during run time. Takes advantage of the full capabilities of virtual memory. The disadvantage is the considerable overhead and complexity incurred due to postponement of actions till run time. 12

13 Compiler Are system programs that translates an input program in a high level language into its machine language equivalent 13 Ask the participants what is HLL (High Level Language)? Features of a HLL: High degree of machine independence Good data structures Improved debugging capability Good documentation Example: COBOL,PASCAL, FORTRAN etc. 13

14 Phases in a compiler Lexical analysis Syntactic analysis Semantic analysis Intermediate code generation Code optimization Code generation 14 Compilers are complex system programs. Hence, they are often broken into several phases to accomplish the task. The phases of a compiler are mentioned in the slide above. We shall be interested in looking into the functionality of each slide rather than the concerned algorithms used in implementing the phases. Each phase is an independent task in the compilation process. 14

15 Compiler (Front - End ) Largely dependent on the source language Independent of the target machine Comprises the first three phases viz., Lexical Analysis Syntactic Analysis Semantic Analysis Sometimes the intermediate code generation phase is also included 15 Most of the times, the phases of a compiler are collected into a front-end and a back-end. The front-end comprises of those phases or at times also parts of the phases which depend on the source language and are independent of the target machine. These include lexical analysis, syntactic analysis, creation of symbol table, semantic analysis and generation of intermediate code. It also includes some amount of error handling and code optimization that goes along with these phases. 15

16 Back-End Dependent on the target machine Independent of the source language Includes the last two phases viz., Code Optimization Code Generation 16 The back-end generally includes those phases of the compiler which depend on the target machine. They do not depend on the source language, just the intermediate language. Backend includes code optimization, code generation along with the necessary error handling and symbol-table operations. Taking the front-end of a compiler and redoing its associated back-end to produce a compiler for the same source language on a different machine is quite common these days. 16

17 Lexical Analysis Scans the source program into basic elements called tokens Prepares the symbol table which maintains information about tokens Eliminates whitespace characters such as comments, blanks and tabs 17 Lexical Analyser is also called as linear analysis or a scanner. The input program which consists of a stream of characters is read from left to right and grouped into tokens. Tokens are mainly of two kinds viz., 1. Fixed elements of the language such as keywords, vocabulary of the language, operators, signs etc 2. Identifiers and constants EXAMPLE: IF ( x < 5.0 ) THEN x=x+2 ELSE x=x-3; TOKENS: Keywords : IF, THEN, ELSE Identifier(s) : x Constants : 2, 3, 5.0 The blanks separating these tokens would normally be eliminated during lexical analysis. Nowadays, there are tools to do this phase efficiently. For e.g. in Unix systems, a standard tool called lex is available for this purpose. 17

18 Syntax Analysis Reorganizes major constructs and groups them Calls the appropriate actions corresponding to each construct Ascertains the legality of every statement Output of this phase are parse trees 18 Syntax analysis is also known as parsing or hierarchical analysis. It basically involves grouping of the statements into grammatical phrases that are used by the compiler to generate the output finally. The grammatical phrases of the source program are usually represented by a parse tree( A parse tree is a structural representation of the input being parsed) as shown below: Example: Structure Of Statement ( x= 2* y) Assignment statement = / \ identifier expression / \ x expression + expression / \ expression * expression identifier integer real y Nowadays, there are tools to generate parsers. For e.g. in Unix systems, a tool called as YACC (Yet Another Compiler Compiler) is available for this purpose. 18

19 Semantic Analysis Looks into the static meaning of the program Gathers type information for the subsequent code generation phase 19 Checks whether the type of variables used in the program is consistent with the type defined in the declaration. Example: If a variable is defined as type char, then it is not permitted to do arithmetic operations on that variable. 19

20 Intermediate code generation Transforms the parse tree into an intermediate language representation of the source program. Output would be some other structured representation viz., AST (Abstract Syntax Trees) Quadruples 20 Some compilers generate an explicit intermediate representation of the source program after syntax and semantic analysis. This intermediate representation of the source program can be thought of as a program for an abstract machine and should have two main properties viz., 1. It should be easy to produce 2. It should be easy to translate into the target program 20

21 Necessity for intermediate code generation m languages n machines 21 Let us consider the situation given in the slide above. Suppose, we have to write a complier for m languages targeted for n machines. The obvious approach would be to write m*n compilers. 21

22 Intermediate code generation m languages... INTERMEDIATE CODE n machines An intermediate language avoids most of the problems. It allows a logical separation between machine independent and dependent phases and facilitates optimization. All we have to do is to choose a rich intermediate language that would bridge both the source programs and the target programs. Find out how many front-ends and back-ends would be required in the above example shown in the slide. Intermediate representation has a variety of forms. There are also many algorithms for generating intermediate codes for typical programming language constructs. 22

23 Code Optimization Transforms the intermediate code to improve the execution time and memory space usage Examples Common sub-expression elimination Dead Code Elimination Loop optimization 23 Common Sub - Expression Elimination: Avoid re-computation of expressions Make use of previously computed value Example: y = 2*i z = i*2 Transform y = x and z = x at x = 2*i appropriate points or detect i* 2 as a common expression Dead Code Elimination Consider the following fragment:... x = 10 ; y =... ;... if ( x < 100 ) then y = y + 5 else y = y - 5 else branch will never get executed since the value of x cannot be greater than or equal to 100 Loop Optimization: When a program is in execution, a lot of time is spent in loops. There are various ways to perform optimizations inside the loop. For e.g. If there is a statement such as, TEMP =5, inside a loop which is not affected by other statements, then this can be moved outside the loop. Such an optimization is called as code motion. 23

24 Code Generation Generates the code for the target machine Translates intermediate code to a sequence of machine instructions that perform the desired task Code generator has knowledge of target machine About the number of registers special registers addressing modes etc. 24 The final phase of the compiler is generation of the target code which consists normally consists of relocatable machine code or assembly code. Memory locations are selected for all the variables used by the program. The intermediate instructions are then translated into a sequence of machine instructions that perform the task. Example: Expression : Generated code: x = 2 * y MUL R1, 3.0 ADD R1, y STORE x LOAD R1, 2 In the first instruction, 2 is loaded into register R1. The second instruction multiplies the value 3.0 to the value stored in register R1. The third instruction adds the value in y to the previous result. The final result is stored in x. 24

25 Support modules Provide additional services of storage allocation and error indication which is required by a compiler. Example Symbol table Error processing 25 The support modules interact with all the six phases of a compiler. 25

26 Symbol Table A table which contains information about identifiers encountered during lexical analysis Keeps track of the attributes of the symbols like name type (int, char etc.,), size (in bytes), address of the label 26 A symbol table is a data structure which contains a record for each identifier. The fields of the record contain the attributes of the identifier. This basically helps us to locate the record for each identifier easily and to store or retrieve data from that record quickly. When an identifier in the source program is detected during lexical analysis, its information is stored in the symbol table. The remaining phases of the compiler enter the information about the attributes of the identifier. 26

27 Error Processing Error reporting Giving the error number and pinpoints the appropriate place in the source where the error has been detected Error recovery After reporting an error, continues translation 27 Error processing is required at almost every stage. One an error is detected, error processing module generates an error message for the user. Error processing is of two types viz., 1. Error Reporting 2. Error Recovery Error Reporting - involves getting the line number and pinpointing the appropriate place in the source where exactly the error has been detected. Error Recovery After reporting an error, error processing attempts to either correct or eat up certain lexumes till a certain point from where it can pretend that nothing has gone wrong and continue translation. 27

28 Interpreter Is a systems program that looks at and executes programs on a line-by-line basis rather than producing object code Slower than compiled code Used in test environments as overhead of compilation is not there Generally not recommended for production programs 28 Each line is scanned, parsed and executed before moving to the next line. 28

29 OPERATING SYSTEMS Memory Management Introduction to Operating Systems Introduction to the Concepts of Memory Management 29

30 Operating systems A program which acts as an interface between the user and the computer and provides an environment in which a user can execute programs Viewed as a Resource Allocator or Resource Manager Memory Processors Peripherals Information 30 Primary Goal of an Operating System is convenience for the user. Secondary Goal is efficient operation of the computer system. Resource Examples Managers Memory Primary, Secondary Memory Management Processors CPU, I/O Process Management Peripherals Terminal, Printer, Tape Device Management Information Files, Data File Management Examples: MS-DOS OS/ 2 WINDOWS 3.X WINDOWS 95 WINDOWS NT UNIX 30

31 Memory management Plays an important role as utilization of memory is crucial to the performance of the system Allow as many user jobs as possible to be active Respond to changes in memory demand by individual user jobs Prevent unauthorized changes to a user job s memory region Implement allocation and addressing as efficiently as possible 31 The computer must keep several processes in memory at the same time to improve the CPU utilization and the speed of the response of the computer to its users. Memory management discusses various ways to manage memory. 31

32 Memory management SCHEMES Single Contiguous allocation Partitioned allocation Relocatable Partitioned allocation Simple Paged allocation Demand Paging Segmentation 32 There are various memory management schemes as mentioned in the slide above. Each scheme has its own advantage and disadvantage. Selection of a particular technique depends on various factors such as hardware support, extent of memory available etc. 32

33 Single Contiguous Allocation Memory os User s job Wasted 33 In single contiguous allocation, the user program is given complete control of the CPU until completion or an error occurs. Advantages: Disadvantages: Very simple to implement Leads to uniprogramming Leads to wastage of space Leads to wastage of time (During any I/O operation CPU has to wait till I/O is finished) 33

34 Partitioned Allocation Fixed Partitioned allocation Variable Partitioned allocation 34 To solve the problem of space and time usage, let us break the memory into various partitions. This allows several user jobs to reside in the memory. There are 2 main kinds of partitions viz., Fixed and Variable 34

35 Fixed Partitioned Allocation MEMORY OS JOB 1 JOB 2 JOB 3 FREE 20 K 10 K 30 K 10 K (A) 35 Here, the memory is divided into fixed partitions as shown in the slide above. Advantage: Leads to Multiprogramming (CPU utilization is increased). Disadvantages: Leads to Internal Fragmentation (Explained in the next slide) Solution: Relocatable partition Paged allocation 35

36 Fixed Partitioned Allocation MEMORY MEMORY OS JOB 1 JOB 2 JOB 3 FREE 20 K 10 K 30 K 10 K FREE JOB 2 FREE FREE (A) 36 (B) Disadvantage: 1.Consider the situation where JOB 1(20K) and JOB 3(30K) are over. Now, suppose there is another new job of 50K which has to be executed. In the present scenario as we see in the slide, even though 60K is available, we cannot run a job of 50K because the available memory is not contiguous. 2. If a job of 25K has to be executed it has to go into a 30K slot resulting in wastage of 5K. This occurrence of free space within the active process space is called as Internal Fragmentation. 36

37 Variable Partitioned allocation No predetermined partitioning of memory allocates the exact amount of memory space needed for each process as and when required Processes are loaded into consecutive areas until the memory is filled or remaining space is too small to accommodate a new process. Disadvantage External Fragmentation 37 Self-explanatory 37

38 Variable Partitioned Allocation MEMORY MEMORY OS JOB 1 JOB 2 JOB 3 FREE 20 K 10 K 30 K 10 K FREE JOB 2 FREE FREE (A) 38 (B) Here, the partitions are not fixed. As and when the jobs come, they take up consecutive space in memory. Disadvantage: When a process terminates, the space that was occupied by it is freed and these free spaces are called holes When the holes are formed between active (running) processes, even though the total free space may be sufficient to hold a new process, there may not be a single large enough hole to accommodate the incoming process. This kind of wastage which occurs outside the space allocated for an active process is called External Fragmentation. If the active process in between the holes combine to form one big hole, it is known as Coalescence of holes. 38

39 Relocatable Partitioned Allocation Space wasted due to fragmentation can be used by doing compaction running jobs are squeezed together by relocating them and clubbing the rest of the free space into one large block. Simple to implement 39 In this mode, the active process shifts to one end, leaving the holes to combine to get a much larger space than before. 39

40 Relocatable partitioned allocation MEMORY MEMORY FREE JOB 2 OS 20 K 10 K JOB 2 FREE FREE 30 K FREE FREE 10 K 40 FREE After Compaction The diagram above shows that JOB2 has been moved upward leaving 50 K of contiguous free space. A new job of 50 K can be run now. Disadvantage: Solution: Relocating the running jobs afresh leads to problems that are address dependent Reload & start from beginning every programs that needs to be relocated which is very expensive and at times is an irreversible action Relative addressing mechanism wherein the job is run independent of any program location. The disadvantage of Relative Addressing is that an extra overhead would be incurred because of a separate index register and addressing through the index registers. 40

41 Simple paged allocation Divides the jobs address space into pages of the same size(4k) Divides the main memory address space into blocks/frames(4 K) Pages are units of memory that are swapped in and out of primary memory Pages are grouped together for a given user job and are placed in page tables 41 Simple paged allocation is a solution to fragmentation. Advantage: As each page is separately allocated, the users job need not be contiguous. Disadvantages: Extra memory required for storing page tables Considerable amount of hardware support is required for address transformations etc. All pages of entire job must be in memory 41

42 Simple paged allocation page number block number OS JOB JOB The example in the slide above shows a page map table with 2 columns viz., page number and block number which essentially shows the mapping between page number and block number. JOB1 has 3 pages viz., 0,1,2. Page 0 maps to block 2 in the OS, page 1 to clock 4 and page 2 to block 7 in the OS. JOB 2 has 1 page i.e. page 0 which maps to block 3 in the OS. Thus, we can see that pages of a job need not be located contiguously in the memory. 42

43 Demand paging Illusion of infinite memory available to the user (Virtual Memory) Job operating under demand paging A page is brought to the main memory only when there is a demand 43 This is an enhancement of simple paging wherein the pages are brought into the primary memory from the secondary memory (disk) only on demand. Thus, the entire process is not loaded into the memory at one stretch. It is loaded part by part and executed and then swapped back to the disk so that some other blocks of the same process can be loaded in that place. This gives an illusion to the user that the memory can accommodate and execute a process of any size. Since the full process is not loaded at one stretch, the process size can exceed the total memory size and still be executed. This is known as the virtual memory concept. 43

44 Demand paging Page number Block number Page Table JOB A 1 OS OS Status Judgement 44 The diagram in the slide above shows the page map table for demand paging. The page map table (PMT) has two additional columns viz., status and judgement. Initially, all the pages have status field as NA (Not Available) implying that all the pages are in the secondary device (disk). As and when a page is loaded from the secondary to primary, the status is updated to A (Available) from NA. Now, if the same page is required again in the main memory, the status bit will indicate the presence of it in the primary memory. The judgement field decides if a page has to be moved back to the secondary memory or not. 44

45 Page replacement algorithms Algorithms based on which the pages are selected for replacement Examples Least Frequently Used (LFU) Least Recently Used ( LRU ) Not Recently Used (NRU ) First in First out (FIFO ) 45 LFU: If the algorithm decides to move a page from main memory and store it in secondary memory based on the fact that it is not used often, then it is called LFU. For every page a reference counter is maintained in the judgement field. LRU: If the algorithm decides to move a page from main memory and store it in secondary memory based on the fact that it is not used often in the recent times, then it is called LRU. For every page a timestamp is maintained in the judgement field. NRU: If the algorithm decides to move a page from main memory and store it in secondary memory based on the fact that it is not used at all in the recent times, then it is called NRU. A reference bit is associated with each page. FIFO: If the algorithm decides that the page has been first moved to the memory should be moved out to secondary memory first, then it is using FIFO. 45

46 Thrashing Most of the time is being spent in either swapping in or swapping out of the pages from main memory to secondary memory,instead of doing useful work This high paging activity when happens frequently is called THRASHING To overcome thrashing,system schedules some pages to be removed from memory in the background (Page Stealing) and continues till a certain level of page frames are free 46 Page Fault: If a user job accesses a page and the page is not available in the main memory, a page fault is said to occur Page Replacement: If the memory is full then the inactive pages which are not needed currently for execution are removed and are replaced by those pages from the secondary device which are to be executed. This is called Page Replacement. 46

47 Segmentation Segment is a grouping of information that is treated as a logical entity A process is divided into different segments each of its own length for example one segment can correspond to a single subroutine, a group of closely related subroutines etc. Segmentation uses unequal chunks Chunk size is determined by the programmer Each individual segment can be protected Requires two-level translation : Segment tables to page tables and then to main memory 47 Paging brought about a separation between the user s view of memory and the actual physical memory which is taken care of in segmentation. The user prefers to view memory as a collection of different sized segments with no necessary ordering among the segments. Say for example, when a user writes a program, he thinks about is a main program with a set of subroutines, procedures, functions etc. Each of these modules are referred to by a name and each of these segments are of variable length. The length of a segment is defined by the purpose of the segment in the program. Segmentation is thus a memory management technique which supports the user view of memory. A programmer has a say on the number of segments in a process and this division is dependent on the logical structure of the process. 47

48 Summary System Software Translators Operating System Memory Management 48 48

49 Thank You! 49 49

Welcome to this course on Operating System Concepts

Welcome to this course on Operating System Concepts Welcome to this course on Operating System Concepts 1 2 3 4 6 8 12 13 Operating System is a set of system programs which provides an environment to help the user to execute the programs. The OS is

More information

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Objective PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Explain what is meant by compiler. Explain how the compiler works. Describe various analysis of the source program. Describe the

More information

COMPILER DESIGN LECTURE NOTES

COMPILER DESIGN LECTURE NOTES COMPILER DESIGN LECTURE NOTES UNIT -1 1.1 OVERVIEW OF LANGUAGE PROCESSING SYSTEM 1.2 Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing:

More information

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses. 1 Memory Management Address Binding The normal procedures is to select one of the processes in the input queue and to load that process into memory. As the process executed, it accesses instructions and

More information

Part-A QUESTION BANK UNIT-III 1. Define Dynamic Loading. To obtain better memory-space utilization dynamic loading is used. With dynamic loading, a routine is not loaded until it is called. All routines

More information

UNIT -1 1.1 OVERVIEW OF LANGUAGE PROCESSING SYSTEM 1.2 Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing: A preprocessor may allow a

More information

Main Memory (Part I)

Main Memory (Part I) Main Memory (Part I) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Main Memory 1393/8/5 1 / 47 Motivation and Background Amir

More information

Compiler Design (40-414)

Compiler Design (40-414) Compiler Design (40-414) Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007 Evaluation: Midterm Exam 35% Final Exam 35% Assignments and Quizzes 10% Project

More information

SPOS MODEL ANSWER MAY 2018

SPOS MODEL ANSWER MAY 2018 SPOS MODEL ANSWER MAY 2018 Q 1. a ) Write Algorithm of pass I of two pass assembler. [5] Ans :- begin if starting address is given LOCCTR = starting address; else LOCCTR = 0; while OPCODE!= END do ;; or

More information

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358 Memory Management Reading: Silberschatz chapter 9 Reading: Stallings chapter 7 1 Outline Background Issues in Memory Management Logical Vs Physical address, MMU Dynamic Loading Memory Partitioning Placement

More information

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILING

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILING PRINCIPLES OF COMPILER DESIGN 2 MARKS UNIT I INTRODUCTION TO COMPILING 1. Define compiler? A compiler is a program that reads a program written in one language (source language) and translates it into

More information

Chapter 7 Memory Management

Chapter 7 Memory Management Operating Systems: Internals and Design Principles Chapter 7 Memory Management Ninth Edition William Stallings Frame Page Segment A fixed-length block of main memory. A fixed-length block of data that

More information

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1 Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1 Chapter 9: Memory Management Background Swapping Contiguous Memory Allocation Segmentation

More information

COMPILER DESIGN. For COMPUTER SCIENCE

COMPILER DESIGN. For COMPUTER SCIENCE COMPILER DESIGN For COMPUTER SCIENCE . COMPILER DESIGN SYLLABUS Lexical analysis, parsing, syntax-directed translation. Runtime environments. Intermediate code generation. ANALYSIS OF GATE PAPERS Exam

More information

12: Memory Management

12: Memory Management 12: Memory Management Mark Handley Address Binding Program goes through multiple steps from compilation to execution. At some stage, addresses in the program must be bound to physical memory addresses:

More information

Sardar Vallabhbhai Patel Institute of Technology (SVIT), Vasad M.C.A. Department COSMOS LECTURE SERIES ( ) (ODD) Code Optimization

Sardar Vallabhbhai Patel Institute of Technology (SVIT), Vasad M.C.A. Department COSMOS LECTURE SERIES ( ) (ODD) Code Optimization Sardar Vallabhbhai Patel Institute of Technology (SVIT), Vasad M.C.A. Department COSMOS LECTURE SERIES (2018-19) (ODD) Code Optimization Prof. Jonita Roman Date: 30/06/2018 Time: 9:45 to 10:45 Venue: MCA

More information

UNIT I. Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4. 1

UNIT I. Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4. 1 Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4. 1 UNIT I Introduction: Components of System Software: Text editors, Loaders, Assemblers, Macro processors, Compilers, Debuggers. Machine Structure,

More information

Chapter 3 Memory Management: Virtual Memory

Chapter 3 Memory Management: Virtual Memory Memory Management Where we re going Chapter 3 Memory Management: Virtual Memory Understanding Operating Systems, Fourth Edition Disadvantages of early schemes: Required storing entire program in memory

More information

B. the address of the data is supplied by the users C. there is no need for an address i.e. the data is used as an address

B. the address of the data is supplied by the users C. there is no need for an address i.e. the data is used as an address 1. The part of machine level instruction, which tells the central processor what has to be done, is A. Operation code B. Address C. Locator D. Flip-Flop 2. Which of the following refers to the associative

More information

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Chapter 8 & Chapter 9 Main Memory & Virtual Memory Chapter 8 & Chapter 9 Main Memory & Virtual Memory 1. Various ways of organizing memory hardware. 2. Memory-management techniques: 1. Paging 2. Segmentation. Introduction Memory consists of a large array

More information

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Multiprogramming Memory Management so far 1. Dynamic Loading The main Program gets loaded into memory Routines are stored in Relocatable Load format on disk As main program (or

More information

Compiler, Assembler, and Linker

Compiler, Assembler, and Linker Compiler, Assembler, and Linker Minsoo Ryu Department of Computer Science and Engineering Hanyang University msryu@hanyang.ac.kr What is a Compilation? Preprocessor Compiler Assembler Linker Loader Contents

More information

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization Requirements Relocation Memory management ability to change process image position Protection ability to avoid unwanted memory accesses Sharing ability to share memory portions among processes Logical

More information

Chapter 9 Real Memory Organization and Management

Chapter 9 Real Memory Organization and Management Chapter 9 Real Memory Organization and Management Outline 9.1 Introduction 9.2 Memory Organization 9.3 Memory Management 9.4 Memory Hierarchy 9.5 Memory Management Strategies 9.6 Contiguous vs. Noncontiguous

More information

Chapter 9 Real Memory Organization and Management

Chapter 9 Real Memory Organization and Management Chapter 9 Real Memory Organization and Management Outline 9.1 Introduction 9.2 Memory Organization 9.3 Memory Management 9.4 Memory Hierarchy 9.5 Memory Management Strategies 9.6 Contiguous vs. Noncontiguous

More information

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register Memory Management 1. Describe the sequence of instruction-execution life cycle? A typical instruction-execution life cycle: Fetches (load) an instruction from specific memory address. Decode the instruction

More information

Chapters 9 & 10: Memory Management and Virtual Memory

Chapters 9 & 10: Memory Management and Virtual Memory Chapters 9 & 10: Memory Management and Virtual Memory Important concepts (for final, projects, papers) addressing: physical/absolute, logical/relative/virtual overlays swapping and paging memory protection

More information

Memory Management. Memory Management

Memory Management. Memory Management Memory Management Most demanding di aspect of an operating system Cost has dropped. Consequently size of main memory has expanded enormously. Can we say that we have enough still. Swapping in/out. Memory

More information

General Objective:To understand the basic memory management of operating system. Specific Objectives: At the end of the unit you should be able to:

General Objective:To understand the basic memory management of operating system. Specific Objectives: At the end of the unit you should be able to: F2007/Unit6/1 UNIT 6 OBJECTIVES General Objective:To understand the basic memory management of operating system Specific Objectives: At the end of the unit you should be able to: define the memory management

More information

CS399 New Beginnings. Jonathan Walpole

CS399 New Beginnings. Jonathan Walpole CS399 New Beginnings Jonathan Walpole Memory Management Memory Management Memory a linear array of bytes - Holds O.S. and programs (processes) - Each cell (byte) is named by a unique memory address Recall,

More information

MEMORY MANAGEMENT: Real Storage. Unit IV

MEMORY MANAGEMENT: Real Storage. Unit IV MEMORY MANAGEMENT: Real Storage Unit IV OUTLINE Storage Organization Storage Management Storage Hierarchy Storage Management Strategies Storage Placement Strategies Segmentation Paging & Demand Paging

More information

Memory Management. Memory Management

Memory Management. Memory Management Memory Management Chapter 7 1 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as many processes into memory as possible 2 1 Memory

More information

Compiler Design. Computer Science & Information Technology (CS) Rank under AIR 100

Compiler Design. Computer Science & Information Technology (CS) Rank under AIR 100 GATE- 2016-17 Postal Correspondence 1 Compiler Design Computer Science & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts,

More information

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture have been largely based on those from an earlier edition of the course text Operating

More information

Lecture 7. Memory Management

Lecture 7. Memory Management Lecture 7 Memory Management 1 Lecture Contents 1. Memory Management Requirements 2. Memory Partitioning 3. Paging 4. Segmentation 2 Memory Memory is an array of words or bytes, each with its own address.

More information

CS420: Operating Systems

CS420: Operating Systems Main Memory James Moscola Department of Engineering & Computer Science York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Background Program must

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER-15 EXAMINATION Model Answer Paper

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER-15 EXAMINATION Model Answer Paper Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model answer and the answer written by candidate may

More information

Pioneering Compiler Design

Pioneering Compiler Design Pioneering Compiler Design NikhitaUpreti;Divya Bali&Aabha Sharma CSE,Dronacharya College of Engineering, Gurgaon, Haryana, India nikhita.upreti@gmail.comdivyabali16@gmail.com aabha6@gmail.com Abstract

More information

Operating Systems (2INC0) 2017/18

Operating Systems (2INC0) 2017/18 Operating Systems (2INC0) 2017/18 Memory Management (09) Dr. Courtesy of Dr. I. Radovanovic, Dr. R. Mak (figures from Bic & Shaw) System Architecture and Networking Group Agenda Reminder: OS & resources

More information

UNIT III MEMORY MANAGEMENT

UNIT III MEMORY MANAGEMENT UNIT III MEMORY MANAGEMENT TOPICS TO BE COVERED 3.1 Memory management 3.2 Contiguous allocation i Partitioned memory allocation ii Fixed & variable partitioning iii Swapping iv Relocation v Protection

More information

Address spaces and memory management

Address spaces and memory management Address spaces and memory management Review of processes Process = one or more threads in an address space Thread = stream of executing instructions Address space = memory space used by threads Address

More information

Memory Management. Memory Management Requirements

Memory Management. Memory Management Requirements Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable supply of ready processes to consume available processor time 1 Memory Management

More information

Operating Systems Unit 6. Memory Management

Operating Systems Unit 6. Memory Management Unit 6 Memory Management Structure 6.1 Introduction Objectives 6.2 Logical versus Physical Address Space 6.3 Swapping 6.4 Contiguous Allocation Single partition Allocation Multiple Partition Allocation

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 L17 Main Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Was Great Dijkstra a magician?

More information

ECE4680 Computer Organization and Architecture. Virtual Memory

ECE4680 Computer Organization and Architecture. Virtual Memory ECE468 Computer Organization and Architecture Virtual Memory If I can see it and I can touch it, it s real. If I can t see it but I can touch it, it s invisible. If I can see it but I can t touch it, it

More information

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [MEMORY MANAGEMENT] Matrices in Banker s algorithm Max, need, allocated Shrideep Pallickara Computer Science Colorado

More information

UNIT III LOADERS AND LINKERS

UNIT III LOADERS AND LINKERS UNIT III LOADERS AND LINKERS INTRODUCTION Loader is a system program that performs the loading function. Many loaders also support relocation and linking. Some systems have a linker (linkage editor) to

More information

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

CS6401- Operating System UNIT-III STORAGE MANAGEMENT UNIT-III STORAGE MANAGEMENT Memory Management: Background In general, to rum a program, it must be brought into memory. Input queue collection of processes on the disk that are waiting to be brought into

More information

Memory Management (1) Memory Management

Memory Management (1) Memory Management EECS 3221 Operating System Fundamentals No.8 Memory Management (1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Memory Management A program usually resides on a

More information

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University EECS 3221 Operating System Fundamentals No.8 Memory Management (1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Memory Management A program usually resides on a

More information

Administrivia. Deadlock Prevention Techniques. Handling Deadlock. Deadlock Avoidance

Administrivia. Deadlock Prevention Techniques. Handling Deadlock. Deadlock Avoidance Administrivia Project discussion? Last time Wrapped up deadlock Today: Start memory management SUNY-BINGHAMTON CS35 SPRING 8 LEC. #13 1 Handling Deadlock Deadlock Prevention Techniques Prevent hold and

More information

What do Compilers Produce?

What do Compilers Produce? What do Compilers Produce? Pure Machine Code Compilers may generate code for a particular machine, not assuming any operating system or library routines. This is pure code because it includes nothing beyond

More information

4. An interpreter is a program that

4. An interpreter is a program that 1. In an aboslute loading scheme, which loader function is accomplished by programmer? A. Allocation B. LInking C. Reallocation D. both (A) and (B) 2. A compiler program written in a high level language

More information

LECTURE NOTES ON COMPILER DESIGN P a g e 2

LECTURE NOTES ON COMPILER DESIGN P a g e 2 LECTURE NOTES ON COMPILER DESIGN P a g e 1 (PCCS4305) COMPILER DESIGN KISHORE KUMAR SAHU SR. LECTURER, DEPARTMENT OF INFORMATION TECHNOLOGY ROLAND INSTITUTE OF TECHNOLOGY, BERHAMPUR LECTURE NOTES ON COMPILER

More information

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation

More information

ECE468 Computer Organization and Architecture. Virtual Memory

ECE468 Computer Organization and Architecture. Virtual Memory ECE468 Computer Organization and Architecture Virtual Memory ECE468 vm.1 Review: The Principle of Locality Probability of reference 0 Address Space 2 The Principle of Locality: Program access a relatively

More information

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science Memory Management CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture are based on those from Operating Systems Concepts, 9th ed., by Silberschatz, Galvin,

More information

Virtual Memory COMPSCI 386

Virtual Memory COMPSCI 386 Virtual Memory COMPSCI 386 Motivation An instruction to be executed must be in physical memory, but there may not be enough space for all ready processes. Typically the entire program is not needed. Exception

More information

COMPILER DESIGN LEXICAL ANALYSIS, PARSING

COMPILER DESIGN LEXICAL ANALYSIS, PARSING COMPILER DESIGN LEXICAL ANALYSIS, PARSING 1. Which of the following system program forgoes the production of object code to generate absolute machine code and load it into the Physical main storage location

More information

Memory: Overview. CS439: Principles of Computer Systems February 26, 2018

Memory: Overview. CS439: Principles of Computer Systems February 26, 2018 Memory: Overview CS439: Principles of Computer Systems February 26, 2018 Where We Are In the Course Just finished: Processes & Threads CPU Scheduling Synchronization Next: Memory Management Virtual Memory

More information

Formats of Translated Programs

Formats of Translated Programs Formats of Translated Programs Compilers differ in the format of the target code they generate. Target formats may be categorized as assembly language, relocatable binary, or memory-image. Assembly Language

More information

Operating Systems Memory Management. Mathieu Delalandre University of Tours, Tours city, France

Operating Systems Memory Management. Mathieu Delalandre University of Tours, Tours city, France Operating Systems Memory Management Mathieu Delalandre University of Tours, Tours city, France mathieu.delalandre@univ-tours.fr 1 Operating Systems Memory Management 1. Introduction 2. Contiguous memory

More information

Compilers. Prerequisites

Compilers. Prerequisites Compilers Prerequisites Data structures & algorithms Linked lists, dictionaries, trees, hash tables Formal languages & automata Regular expressions, finite automata, context-free grammars Machine organization

More information

File Systems. OS Overview I/O. Swap. Management. Operations CPU. Hard Drive. Management. Memory. Hard Drive. CSI3131 Topics. Structure.

File Systems. OS Overview I/O. Swap. Management. Operations CPU. Hard Drive. Management. Memory. Hard Drive. CSI3131 Topics. Structure. File Systems I/O Management Hard Drive Management Virtual Memory Swap Memory Management Storage and I/O Introduction CSI3131 Topics Process Management Computing Systems Memory CPU Peripherals Processes

More information

Outlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium

Outlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium Main Memory Outlook Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 2 Backgound Background So far we considered how to share

More information

Last Class: Deadlocks. Where we are in the course

Last Class: Deadlocks. Where we are in the course Last Class: Deadlocks Necessary conditions for deadlock: Mutual exclusion Hold and wait No preemption Circular wait Ways of handling deadlock Deadlock detection and recovery Deadlock prevention Deadlock

More information

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference

More information

3. Memory Management

3. Memory Management Principles of Operating Systems CS 446/646 3. Memory Management René Doursat Department of Computer Science & Engineering University of Nevada, Reno Spring 2006 Principles of Operating Systems CS 446/646

More information

Basic Memory Management

Basic Memory Management Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester 10/15/14 CSC 2/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it

More information

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University Memory Management Frédéric Haziza Department of Computer Systems Uppsala University Spring 2008 Operating Systems Process Management Memory Management Storage Management Compilers Compiling

More information

Chapter 8 Memory Management

Chapter 8 Memory Management 1 Chapter 8 Memory Management The technique we will describe are: 1. Single continuous memory management 2. Partitioned memory management 3. Relocatable partitioned memory management 4. Paged memory management

More information

UNIT I INTRODUCTION TO COMPILER 1. What is a Complier? A Complier is a program that reads a program written in one language-the source language-and translates it in to an equivalent program in another

More information

LESSON 13: LANGUAGE TRANSLATION

LESSON 13: LANGUAGE TRANSLATION LESSON 13: LANGUAGE TRANSLATION Objective Interpreters and Compilers. Language Translation Phases. Interpreters and Compilers A COMPILER is a program that translates a complete source program into machine

More information

Chapter 3 Loaders and Linkers

Chapter 3 Loaders and Linkers Chapter 3 Loaders and Linkers Three fundamental processes: Loading brings the object program into memory for execution. Relocation modifies the object program so that it can be loaded at an address different

More information

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it to be run Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester Mono-programming

More information

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program!

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program! Memory Management in a Uniprogrammed System! A! gets a fixed segment of (usually highest )"! One process executes at a time in a single segment"! Process is always loaded at "! Compiler and linker generate

More information

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD OPERATING SYSTEMS #8 After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD MEMORY MANAGEMENT MEMORY MANAGEMENT The memory is one of

More information

9.1 Background. In Chapter 6, we showed how the CPU can be shared by a set of processes. As a result of

9.1 Background. In Chapter 6, we showed how the CPU can be shared by a set of processes. As a result of Chapter 9 MEMORY MANAGEMENT In Chapter 6, we showed how the CPU can be shared by a set of processes. As a result of CPU scheduling, we can improve both the utilization of the CPU and the speed of the computer's

More information

CIS Operating Systems Memory Management. Professor Qiang Zeng Fall 2017

CIS Operating Systems Memory Management. Professor Qiang Zeng Fall 2017 CIS 5512 - Operating Systems Memory Management Professor Qiang Zeng Fall 2017 Previous class Uniprocessor policies FCFS, Shortest Job First Round Robin Multilevel Feedback Queue Multiprocessor policies

More information

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit Memory Management All data in memory before and after processing All instructions in memory in order to execute Memory management determines what is to be in memory Memory management activities Keeping

More information

Background. Contiguous Memory Allocation

Background. Contiguous Memory Allocation Operating System Lecture 8 2017.5.9 Chapter 8 (Main Memory) Background Swapping Contiguous Memory Allocation Segmentation - Paging Memory Management Selection of a memory-management method for a specific

More information

Preview. Memory Management

Preview. Memory Management Preview Memory Management With Mono-Process With Multi-Processes Multi-process with Fixed Partitions Modeling Multiprogramming Swapping Memory Management with Bitmaps Memory Management with Free-List Virtual

More information

Chapter 8: Virtual Memory. Operating System Concepts

Chapter 8: Virtual Memory. Operating System Concepts Chapter 8: Virtual Memory Silberschatz, Galvin and Gagne 2009 Chapter 8: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating

More information

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition Chapter 8: Memory Management 8.1 Silberschatz, Galvin and Gagne 2009 Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are

More information

6 - Main Memory EECE 315 (101) ECE UBC 2013 W2

6 - Main Memory EECE 315 (101) ECE UBC 2013 W2 6 - Main Memory EECE 315 (101) ECE UBC 2013 W2 Acknowledgement: This set of slides is partly based on the PPTs provided by the Wiley s companion website (including textbook images, when not explicitly

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 L20 Virtual Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Questions from last time Page

More information

SEM / YEAR : VI / III CS2352 PRINCIPLES OF COMPLIERS DESIGN UNIT I - LEXICAL ANALYSIS PART - A

SEM / YEAR : VI / III CS2352 PRINCIPLES OF COMPLIERS DESIGN UNIT I - LEXICAL ANALYSIS PART - A SEM / YEAR : VI / III CS2352 PRINCIPLES OF COMPLIERS DESIGN UNIT I - LEXICAL ANALYSIS PART - A 1. What is a compiler? (A.U Nov/Dec 2007) A compiler is a program that reads a program written in one language

More information

Chapter 8. Operating System Support. Yonsei University

Chapter 8. Operating System Support. Yonsei University Chapter 8 Operating System Support Contents Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management 8-2 OS Objectives & Functions OS is a program that Manages the

More information

CD Assignment I. 1. Explain the various phases of the compiler with a simple example.

CD Assignment I. 1. Explain the various phases of the compiler with a simple example. CD Assignment I 1. Explain the various phases of the compiler with a simple example. The compilation process is a sequence of various phases. Each phase takes input from the previous, and passes the output

More information

Chapter 9: Virtual-Memory

Chapter 9: Virtual-Memory Chapter 9: Virtual-Memory Management Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation of Frames Thrashing Other Considerations Silberschatz, Galvin and Gagne 2013

More information

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation

More information

Chapter 8: Memory- Management Strategies

Chapter 8: Memory- Management Strategies Chapter 8: Memory Management Strategies Chapter 8: Memory- Management Strategies Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and

More information

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time Memory Management To provide a detailed description of various ways of organizing memory hardware To discuss various memory-management techniques, including paging and segmentation To provide a detailed

More information

Operating Systems: Internals and Design Principles. Chapter 7 Memory Management Seventh Edition William Stallings

Operating Systems: Internals and Design Principles. Chapter 7 Memory Management Seventh Edition William Stallings Operating Systems: Internals and Design Principles Chapter 7 Memory Management Seventh Edition William Stallings Memory Management Requirements Memory management is intended to satisfy the following requirements:

More information

Operating System Support

Operating System Support Operating System Support Objectives and Functions Convenience Making the computer easier to use Efficiency Allowing better use of computer resources Layers and Views of a Computer System Operating System

More information

! What is main memory? ! What is static and dynamic allocation? ! What is segmentation? Maria Hybinette, UGA. High Address (0x7fffffff) !

! What is main memory? ! What is static and dynamic allocation? ! What is segmentation? Maria Hybinette, UGA. High Address (0x7fffffff) ! Memory Questions? CSCI [4 6]730 Operating Systems Main Memory! What is main memory?! How does multiple processes share memory space?» Key is how do they refer to memory addresses?! What is static and dynamic

More information

MEMORY MANAGEMENT/1 CS 409, FALL 2013

MEMORY MANAGEMENT/1 CS 409, FALL 2013 MEMORY MANAGEMENT Requirements: Relocation (to different memory areas) Protection (run time, usually implemented together with relocation) Sharing (and also protection) Logical organization Physical organization

More information

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective Part I: Operating system overview: Memory Management 1 Hardware background The role of primary memory Program

More information

Course: Operating Systems Instructor: M Umair. M Umair

Course: Operating Systems Instructor: M Umair. M Umair Course: Operating Systems Instructor: M Umair Memory Management Introduction { Ref: Operating System Concepts 8th Edition Abraham Silberschatz, Greg Gagne, Peter B. Galvin } Address Binding Addresses in

More information

Chapter 8. Virtual Memory

Chapter 8. Virtual Memory Operating System Chapter 8. Virtual Memory Lynn Choi School of Electrical Engineering Motivated by Memory Hierarchy Principles of Locality Speed vs. size vs. cost tradeoff Locality principle Spatial Locality:

More information