System Call System Program Linker/Loader with Examples Types of computing Environment

Similar documents
Chapter 1: Introduction. Operating System Concepts 8th Edition,

Chapter 2: Operating-System Structures. Operating System Concepts 8 th Edition

Chapter 1: Introduction. Operating System Concepts 8 th Edition,

Operating System Services

CS420: Operating Systems

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

CS420: Operating Systems

To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Chapter 1: Introduction

7/20/2008. What Operating Systems Do Computer-System Organization

Chapter 1: Introduction. Chapter 1: Introduction

Chapter 1: Introduction

Chapter 1: Introduction

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

European University of Lefke. Instructor: Dr. Arif SARI

DM510 Operating Systems. Jacob Aae Mikkelsen

CS370 Operating Systems

Course Details. Operating Systems with C/C++ Course Details. What is an Operating System?

Operating Systems. Lecture Course in Autumn Term 2015 University of Birmingham. Eike Ritter. September 22, 2015

Introduction to Operating Systems (Part II)

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

CS370 Operating Systems

Operating Systems. Overview. Dr Alun Moon. Computing, Engineering and Information Sciences. 27th September 2011

CS370 Operating Systems

Lecture 1 Introduction (Chapter 1 of Textbook)

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals

Lecture 1 - Operating System Overview

OS: An Overview. ICS332 Operating Systems

SRIMAAN COACHING CENTRE-TRB-COMPUTER INSTRUCTORS STUDY MATERIAL CONTACT: III

OPERATING SYSTEMS Lecture Notes. Prepared by K.Rohini, Assistant Professor, CSE Department, GVPCEW.

CSC Operating Systems Spring Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. January 17 th, 2007.

Announcements. Operating System Structure. Roadmap. Operating System Structure. Multitasking Example. Tevfik Ko!ar

Introduction to PC Operating Systems

The Lesson Plan of OS. The syllabus of OS. Access the lesson plan and syllabus at

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Introduction. Chapter Prof. Amr El-Kadi

CSE Opera+ng System Principles

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edit9on

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

CS420: Operating Systems. OS Services & System Calls

CHAPTER 1 - INTRODUCTION. Jacob Aae Mikk elsen

Introduction. TDDI04, K. Arvidsson, IDA, Linköpings universitet Contents. What is an Operating System (OS)?

CSE 4/521 Introduction to Operating Systems

Chapter 2: System Structures. Operating System Concepts 9 th Edition

Four Components of a Computer System

Introduction. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

Dinosaurs? & Dinosaur Wars. CSCI 6730 / 4730 Operating Systems. Questions? Outline & Questions. Poll? Popularity: The OS Market Share

CPSC 341 OS & Networks. Introduction. Dr. Yingwu Zhu

COURSE OVERVIEW & OPERATING SYSTEMS CONCEPT Operating Systems Design Euiseong Seo

Dinosaurs? & Dinosaur Wars. Outline & Questions. Evolution of our Textbook. Poll? Questions?

Introduction. Chapter Prof. Amr El-Kadi

(Refer Slide Time: 1:26)

ECE 650 Systems Programming & Engineering. Spring 2018

Operating System Concepts 9 th Edit9on

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

UNIT 2. OPERATING SYSTEM STRUCTURES

Frederick P. Brooks tar dinosaurs tar tar tar pit

Lecture 2 - Fundamental Concepts

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - II OS Structures. University at Buffalo. OS Design and Implementation

OS Design Approaches. Roadmap. System Calls. Tevfik Koşar. Operating System Design and Implementation. CSE 421/521 - Operating Systems Fall 2013

Introduction to Operating Systems

Chapter 2: Operating-System Structures. Operating System Concepts Essentials 8 th Edition

OPERATING SYSTEMS UNIT - 1

Operating Systems Spring 2013, Ort Braude College Electrical Engineering Department

Chapter 2: Operating-System

What we saw. Desarrollo de Aplicaciones en Red. 1. OS Design. 2. Service description. 1.1 Operating System Service (1)

CSC 453 Operating Systems

Chapter 2: System Structures

Four Components of a Computer System. Operating System Concepts 7 th Edition, Jan 12, 2005

Lecture 2 Operating System Structures (chapter 2)

Objectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services

Operating Systems. studykorner.org

OPERATING SYSTEMS. Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne

Process Description and Control

Chapter 2. Operating-System Structures

PG-TRB COMPUTER INSTRUCTOR OPERATING SYSTEMS

Chapter 3: Operating-System Structures

Overview of Operating Systems

Kernel Types Simple OS Examples System Calls. Operating Systems. Autumn CS4023

ELEC 377 Operating Systems. Week 1 Class 2

CSC Operating Systems Fall Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. August 27 th, 2009.

Announcements. Computer System Organization. Roadmap. Major OS Components. Processes. Tevfik Ko!ar. CSC Operating Systems Fall 2009

Some popular Operating Systems include Linux Operating System, Windows Operating System, VMS, OS/400, AIX, z/os, etc.

* What are the different states for a task in an OS?

HIGH PERFORMANCE COMPUTING: MODELS, METHODS, & MEANS OPERATING SYSTEMS 1

CS510 Operating System Foundations. Jonathan Walpole

Computer-System Architecture (cont.) Symmetrically Constructed Clusters (cont.) Advantages: 1. Greater computational power by running applications

OS Design Approaches. Roadmap. OS Design Approaches. Tevfik Koşar. Operating System Design and Implementation

EXPERIMENT NO : M/C Lenovo Think center M700 Ci3,6100,6th Gen. H81, 4GB RAM,500GB HDD

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Architectural Support for Operating Systems. Jinkyu Jeong ( Computer Systems Laboratory Sungkyunkwan University

Operating Systems (2INC0) 2018/19. Introduction (01) Dr. Tanir Ozcelebi. Courtesy of Prof. Dr. Johan Lukkien. System Architecture and Networking Group

Threads. Raju Pandey Department of Computer Sciences University of California, Davis Spring 2011

Chapter 2: Operating-System Structures

Chapter 2: Operating-System Structures

Introduction to Operating Systems (Part III)

CS307: Operating Systems

CHAPTER 2: SYSTEM STRUCTURES. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Transcription:

CS341: Operating System Lect06 : 13 th Aug 2014 System Program Linker/Loader with Examples Types of computing Environment Dr A Sahu Dept of Comp Sc & Engg Indian Institute of Technology Guwahati 1 2 OS provide An environment for execution of programs And services to programs and users Services One set of OS services provides functions that are helpful to the user Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing Program Execution User, user program and Other system Program Error Detection GUI Batch Command line I/O Operation System User Interfaces Services Communication Operating System Hardware Resource Allocation Protection & Security Accounting Programming interface to the services provided by the OS Typically written in a high level language (C or C++) Mostly accessed by programs Via a high level Application Programming Interface (API) rather than direct system call use Three most common APIs are Win32 API for Windows POSIX API for POSIX based systems (including virtually all versions of UNIX, Linux, and Mac OS X), Java API for the Java virtual machine (JVM) User Process User Process Executing Kernel Call Trap Mode Bit=0 Execute Return from Return Mode Bit=1 User Mode Mode bit =0 Kernel Mode Mode bit =1 Note that the system call names used throughout this course are generic 1

C program invoking printf() library call, which calls write() system call User Mode Kernel Mode #include<stdioh> intmain(){ printf( Hello World ); return 0; } Standard C Library (libcso) write() write system call() System call sequence to copy the contents of one file to another file Source Example of Sys Call Sequence Acquire input file name Write prompt to screen Accept input Acquire output filename Write prompt to screen Accept input Open the input file If file does not exist, abort Destination Create output file If file exist, abort Loop Read from input file write to output file Until read fails Close output file Write completion message to screen Terminate normally Standard API to read data from file or I/O #include <unistdh> ssize_t read(int fd, void *buff, size_tcount); I/O device abstracted as $ man 2 read // 2nd manual Typically, a number associated with each system call System call interface maintains a table indexed according to these numbers The system call interface invokes the intended system call in OS kernel And returns status of the system call and any return values The caller need know nothing about how the system call is implemented Just needs to obey API and understand what OS will do as a result call Most details of OS interface hidden from programmer by API Managed by run time support library (set of functions built into libraries included with compiler) User mode Kernel mode open() User Application System call Interface open(){ //Implemenationof open() system call return } 2

Process Memory Storage I/Os Subsystem Protection and Security So user need system call service of OSfor all above items 13 14 A process is a program in execution Processis a unit of work within the system Program is a passive entity, process is an active entity Processneeds resources to accomplish its task CPU, memory, I/O, files Initialization data Process termination requires reclaim of any reusable resources OS is responsible for the following activities in connection with process management: Creating and deleting both user and system processes Suspending and resuming processes Providing mechanisms for Process synchronization, communication, Deadlock handling Next Slide definition of synch, comm& deadlock Synchronization Two process trying access a shared object/variable Need to be access one at a time: Mutual Exclusion Mutex, Lock, Monitor ===> Pthread API Communication : When many process collaborate and ddo a big work, Sending message through h pipe/socket Deadlock No progress Circular Wait Single threaded process has one program counter specifying location of next instruction to execute Process executes instructions sequentially, one at a time, until completion 17 3

Multi threaded process has one program counter per thread Typically system has many processes, some user, some operating system running concurrently on one or morecpus Concurrency by multiplexing the CPUs among the processes / threads create process, terminate process end, abort, load, execute get process attributes, set process attributes wait for time, wait event, signal event allocate and free memory Dump memory if error Debuggerfor determining bugs, single step execution Locksfor managing access to shared data between processes To execute a program All(or part) of the instructions must be in memory All (or part) of the data that is needed by the program must tbe in memory Memory management determines what is in memory and when Optimizing CPU utilization and computer response to users 21 Memory management activities Keeping track of which parts of memory are currently being used and by whom Deciding which processes (or parts thereof) and ddtt data to move into itand out of memory Allocating and deallocatingmemory space as needed Usually disks used to store data that Does not fit in main memory Or data that must be kept for a long period of time Proper management is of central importance Entire speed of computer operation really Hinges on disk subsystem and its algorithms 4

OS activities Free space management, Storage allocation Disk scheduling Some storage need not be fast Tertiary storage includes optical storage, magnetic tape Still must be managed by OS or applications Varies between WORM (write once, readmany times) and RW (read write) Hard Disk Main A Memory A Cache A Register Multitasking environments must be careful to use most recent value, no matter where it is stored in the storage hierarchy Multiprocessor environment must provide cache coherency in hardware such that all CPUs have the most recent value in their cache Distributed environment situation even more complex Several copies of a datum can exist OS provides uniform, logical view of information storage Abstracts physical properties to logical storage unit file Each medium is controlled by device (ie, disk drive, tape drive) Varying properties include access speed, capacity, data transfer rate, access method (sequential or random) System Management s usually organized into directories Access control on most systems to determine who can access what OS activities include Creating and deleting files and directories Primitives to manipulate files and directories Mapping files onto secondary storage Backup files onto stable (non volatile) storage media One purpose of OS is to hide peculiarities of hardware devices from the user I/O subsystem responsible for Memory management of I/O Buffering(storingdatatemporarilywhileitisbeing temporarily it is transferred), Caching (storing parts of data in faster storage for performance), Spooling (the overlapping of output of one job with input of other jobs) General device driver interface Drivers for specific hardware devices management create file, delete file, open, close file read, write, reposition get and set file attributes Device management request device, release device read, write, reposition get device attributes, set device attributes logically attach or detach devices 5

Communications create, delete communication connection send, receive messages if message passing model to host nameor process name: From clienttoserver Shared memory model create and gain access to memory regions transfer status information attach and detach remote devices Protection any mechanism for controlling access of processes or users to resources defined by the OS Security defense of the system against internal and external attacks Huge range, including denial of service, worms, viruses, identity theft, theft of service Privilege escalation allows user to change to effective ID with more rights Systems generally first distinguish among users, to determine who can do what User identities (user IDs, security IDs) include name and associated number, one per user User ID then associated with all files, processes of that userto determine access control Group identifier (group ID) allows set of users to be defined and controls managed, then also associated with each process, file Privilege escalation allows user to change to effective ID with more rights Ex: sudo Information maintenance get time or date, set time or date get system data, set system data get and set process, file, or device attributes Protection Control access to resources Get and set permissions Allow and deny user access Process Control Window CreatePrtocess() Exit Process() Linux fork() exit() WaitForSingleObject() wrait() Create() open() Manipulation Read read() Write() write() Device Manipulation CloseHandle() SetControlMode() ReadConsole() WriteConsole() close() ioctl() read() write() Information Maintenance Window GetCurrentProcessID() SetTimer() Linux getpid() alarm() Sleep() sleep() Commu CreatePipe() pipe(); nication CreateMapping() shmget() MapViewOf() mmap() Protection SetSecurity() chmod() InitializeSecurityDescriptor() umask() SetSecurityDescriptor Group() chown() 6