W EEK S IX O PERATING S YSTEM S TRUCTURE. T HE C ONCEPT OF L OADING AND L INKING Loader – Loader is a utility program which takes object code as input,

Slides:



Advertisements
Similar presentations
Operating Systems Components of OS
Advertisements

Dr. Kalpakis CMSC 421, Operating Systems Operating-System Structures.
Chap 2 System Structures.
Operating-System Structures
3.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 3: Operating-System Structures System Components Operating System.
Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Chapter 2: Operating-System Structures.
1/21/2008CSCI 315 Operating Systems Design1 Operating System Structures Notice: The slides for this lecture have been largely based on those accompanying.
Chapter 2: Operating-System Structures
Modified from Silberschatz, Galvin and Gagne ©2009 CS 446/646 Principles of Operating Systems Lecture 3 Chapter 2: Operating-System Structures.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
Common System Components
Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Chapter 2: Operating-System Structures.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 2: Operating-System Structures.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System.
Abhinav Kamra Computer Science, Columbia University 3.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 3: Operating-System Structures.
2.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 2: Operating-System Structures.
Operating Systems Lecture 4. Agenda for Today Review of previous lecture Operating system structures Operating system design and implementation UNIX/Linux.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 6 System Calls OS System.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
Silberschatz and Galvin  Operating System Concepts Module 3: Operating-System Structures System Components Operating System Services System Calls.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
3.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 3: Operating-System Structures System Components Operating System.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 3: Operating-System Structures System Components Operating System Services.
3.1 Operating System Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual.
Processes Introduction to Operating Systems: Module 3.
Operating Systems Structure what is the organizational principle?
1 CSE Department MAITSandeep Tayal Operating-System Structures System Components Operating System Services System Calls System Programs System Structure.
Shan Gao Fall 2007 Department of Computer Science Georgia State University.
Silberschatz, Galvin and Gagne  Operating System Concepts UNIT II Operating System Services.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 3 Operating-System Structures Slide 1 Chapter 3 Operating-System Structures.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Lecture 2: OS Structures (Chapter 2.7)
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
2.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition System Programs (p73) System programs provide a convenient environment.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Lecture 8 Chapter 2: Operating-System Structures Provided & Updated by Sameer.
Loaders and Linkers T 李俊葦. 1. Loader Accepts the object programs , prepares these programs for execution by the computer , and indicates the execution.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Module 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System.
Chapter 2: Operating-System Structures
Computer System Structures
OPERATING SYSTEM CONCEPTS AND PRACTISE
Module 3: Operating-System Structures
Operating System Structures
Chapter 2: Operating-System Structures
Operating System Structure
Lecture 4: Operating System Structures
Chapter 2: System Structures
Operating System Structure
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Ch 2 - Overview Interacting with services provided by the OS
Chapter 2: System Structures
Operating Systems Lecture 4.
Chapter 3: Operating-System Structures
Memory Management Tasks
Chapter 2: Operating-System Structures
Outline Chapter 2 (cont) OS Design OS structure
Chapter 2: Operating-System Structures
System calls….. C-program->POSIX call
Chapter 2: Operating-System Structures
Presentation transcript:

W EEK S IX O PERATING S YSTEM S TRUCTURE

T HE C ONCEPT OF L OADING AND L INKING Loader – Loader is a utility program which takes object code as input, prepares it for execution and loads the executable code into memory. Loader is actually responsible for initiating the execution process. Functions of loaders Allocating – Loader calculates the size of executable program and allocates memory space. This activity is called allocation. Linking – It resolves the symbolic references (code/data) between the object modules, by assigning all the user subroutine and library subroutine addresses. This activity is called linking. Relocation – There are some address dependent locations in a program, such address constants must be adjusted according to allocated space, such activity done by loader is called relocation. Loading – It places all the machine instructions and data of corresponding programs and subroutines into the memory. Thus program now becomes ready for execution and this activity is called loading.

L OADER S CHEMES Compile and go loader – The instruction is read line by line, its machine code is obtained and it is directly put into the memory at some known address. This means assembler is run in one part of the memory and the assembled machine instructions and data is directly put into their assigned memory addresses. After this process, starting address of the program is assigned to the location counter. Disadvantages: Requires more memory as assembler needs to use some portion of memory No object file (.obj), the source is directly converted to executable form. Hence no modification is required but source code needs to be assembled and executed each time. Thus it becomes a time consuming activity. It cannot handle multiple source or programs written in multiple languages as one assembler cannot translate source from different languages. More execution time is required as every time the program needs to be assembled and then executed Advantages: Easy to implement as assembler is placed at one part of the memory and loader simply loads assembled machine instructions into memory

L OADER S CHEMES General Loader – Source code is translated into object program by some assembler. The loader accepts these object modules and puts machine instructions and data in an executable form at their assigned memory. Loader requires some memory. Advantages: Program need not to be translated every time as source code is already in object code format. More memory is available for program as assembler is not occupying any memory. It is possible to write source code in multiple languages as the object is already translated by corresponding assemblers

G ENERAL L OADER S CHEME Source Program Translator Object Program 1 Object Program 2 Loader Executable Object Code Loader Program Main Memory

L OADER S CHEMES Absolute Loader –Is a kind of loader which accepts relocated object files and place them at specified locations in memory. It is called absolute as no relocation information is needed; it is provided by the programmer or assembler. Programmer needs to have the knowledge of memory management Issues of any external references or linking of any sub-routines need to be carried out by programmer. Specific address of each module needs to be provided by programmer When branching out, absolute address is to be known by programmer.

L OADER S CHEMES Absolute Loader Advantages: Simple to implement Allows to write multiple programs or source programs in multiple languages. Assemblers provide object code with all address resolutions. The task of loader becomes simpler as it just needs to obey instructions. The execution process is efficient. Disadvantages: o Programmer needs to know about memory management.

L OADER S CHEMES Direct Link Loaders The most common type of loader This type is a re-locatable loader There are two situations to place address at appropriate location in the memory Absolute address Relative Address Assembler informs the loader about relative address Address of all segments which are not defined in the current segment but can be used in the current segment The list of all segments which are defined in the current segment but can be used by other segments

L INKAGE E DITOR The execution of a program needs four functionalities : allocation, relocation, linking and loading Program that performs allocation, relocation and linking is called binder The binder which performs the linkage function and produces adequate information about allocation and relocation and writes this information along with program is called linkage editor.

P ROCESS OF L INKING AND L OADING Translator Linker Loader Output Given to Output Loaded into Memory

O PERATING S YSTEM D ESIGN AND I MPLEMENTATION Design and implementation of OS not “solvable” but some approaches have been proven successful Internal structure of different operating systems can vary widely Start by defining goals and specifications Affected by choice of hardware, type of system User goals and system goals User goals – operating system should be convenient to use easy to learn, reliable, safe and fast System goals – operating system should be easy to design, implement and maintain, as well as flexible, reliable, error-free, and efficient

O PERATING S YSTEM D ESIGN AND I MPLEMENTATION Important principle to separate Policy -What will be done? Mechanism – How to do it? Mechanisms determine how to do something, policies what will be done The separation of policy from mechanism is a very important principle, it allows maximum flexibility if policy decisions are to be changed later

S IMPLE S TRUCTURE MS DOS MD DOS – Written to provide the most functionality in the least space Not divided into modules Although MS DOS has some structure, its interfaces and functionality are not very well separated

MS DOS L AYER S TRUCTURE

L AYERED A PPROACH The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0) is the hardware; the highest (layer n) is the user interface With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers

T RADITIONAL U NIX S YSTEM S TRUCTURE

UNIX UNIX- Limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX Operating System consists of two separable parts System Programs Kernel Consists of every thing below the system- call interface, and above the physical hardware Provides the file system, CPU scheduling, memory management and other operating system functions: a large number of functions for one level

L AYERED O PERATING S YSTEM

M ICROKERNEL S YSTEMM Moves as much from the kernel into “user” space Communication takes place between user modules using message passing Benefits Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) More secure Detriments Performance overhead of user space to kernel space communication

M ODULES Most modern operating systems implement kernel mode User object-oriented approach Each core component is separate Each talks to the others over known interfaces Each is loadable as needed within the kernel Overall, similar to layers but with more flexibility

S OLARIS M ODULAR A PPROACH

V IRTUAL M ACHINES A virtual machine takes the layered approach to its logical conclusion. It treats the hardware and operating system kernel as though they were all hardware A virtual machine provides an interface identical to the underlying bare hardware The operating system host creates the illusion that a process has its own processor and (virtual memory) Each guest provided with virtual (copy) of underlying computer

V IRTUAL M ACHINE Non Virtual Machine Virtual Machine

V IRTUALIZATION I MPLEMENTATION Difficult to implement – must provide an exact duplicate of underlying machine Typically runs in user mode, creates virtual user mode and virtual kernel mode Timing can be an issue - slower than real machine Hardware support needed More support –> better virtualization i.e. AMD provides “host” and “guest” modes

S OLARIS 10 W ITH T WO C ONTAINERS

VM WARE A RCHITECTURE

T HE JAVA V IRTUAL M ACHINE

O PERATING S YSTEM D EBUGGING Debugging is finding and fixing errors, or bugs OSes generate log files containing error information Failure of application can generate core dump file capturing memory of the process Operating system failure can generate crash dump file containing kernel memory Beyond crashes, performance tuning can optimize system performance

S OLARIS 10 D TRACE F OLLOWING S YSTEM C ALL

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