Operating Systems and Networks

Similar documents
OPERATING SYSTEM SERVICES

CS3600 SYSTEMS AND NETWORKS

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

CS420: Operating Systems OS Services & System Calls

Operating System Structures

Example of Standard API

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

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

System Structures. Services Interface Structure

Chapter 2 System Structures

Chapter 3 Operating-System Structures

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

ELEC 377. Operating Systems. Week 1 Class 3

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

Chapter 6, The Operating System Machine Level

Operating- System Structures

Operating System Structure

System Calls and Standard I/O

Operating Systems. Design and Implementation. Andrew S. Tanenbaum Melanie Rieback Arno Bakker. Vrije Universiteit Amsterdam

Outline. Operating Systems Design and Implementation. Chap 1 - Overview. What is an OS? 28/10/2014. Introduction

Chapter 10 Case Study 1: LINUX

OPERATING SYSTEMS STRUCTURES

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c February 2015

Real Time Programming: Concepts

Lecture 1 Operating System Overview

How do Users and Processes interact with the Operating System? Services for Processes. OS Structure with Services. Services for the OS Itself

Chapter 3: Operating-System Structures. Common System Components

CSC 2405: Computer Systems II

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Operating System Engineering: Fall 2005

Red Hat Linux Internals

COS 318: Operating Systems

Operating System Components

Operating Systems 4 th Class

Multi-core Programming System Overview

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

Operating System Tutorial

How To Write Portable Programs In C

Have both hardware and software. Want to hide the details from the programmer (user).

Restraining Execution Environments

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Mutual Exclusion using Monitors

CatDV Pro Workgroup Serve r

Leak Check Version 2.1 for Linux TM

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes

Operating Systems. Privileged Instructions

Shared Address Space Computing: Programming

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

Compute Cluster Server Lab 3: Debugging the parallel MPI programs in Microsoft Visual Studio 2005

CS161: Operating Systems

Lab 2 : Basic File Server. Introduction

Effective Java Programming. measurement as the basis

1 Posix API vs Windows API

MatrixSSL Porting Guide

Tuning WebSphere Application Server ND 7.0. Royal Cyber Inc.

1.4 SOFTWARE CONCEPTS

Operating System Structures

CPS221 Lecture: Operating System Structure; Virtual Machines

Enterprise Manager Performance Tips

Introduction. System Calls

Oracle EXAM - 1Z Oracle Weblogic Server 11g: System Administration I. Buy Full Product.

Introduction. What is an Operating System?

MatrixSSL Developer s Guide

Kernel comparison of OpenSolaris, Windows Vista and. Linux 2.6

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

File System Management

Jonathan Worthington Scarborough Linux User Group

IBM SDK, Java Technology Edition Version 1. IBM JVM messages IBM

CSC230 Getting Starting in C. Tyler Bletsch

Chapter 12 File Management

Monitoring, Tracing, Debugging (Under Construction)

Chapter 12 File Management. Roadmap

UNIX Sockets. COS 461 Precept 1

Lecture 25 Symbian OS

Distributed File Systems

Linux Driver Devices. Why, When, Which, How?

HeapStats: Your Dependable Helper for Java Applications, from Development to Operation

Operating Systems. Rafael Ramirez (T, S)

Frysk The Systems Monitoring and Debugging Tool. Andrew Cagney

Linux Kernel Architecture

Using DOTS as Apache Derby System Test

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Symmetric Multiprocessing

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015

Virtuozzo Virtualization SDK

OS: IPC I. Cooperating Processes. CIT 595 Spring Message Passing vs. Shared Memory. Message Passing: Unix Pipes

24x7 Scheduler Multi-platform Edition 5.2

What s Cool in the SAP JVM (CON3243)

Java Troubleshooting and Performance

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

Implementing and testing tftp

The Plan Today... System Calls and API's Basics of OS design Virtual Machines

How to create/avoid memory leak in Java and.net? Venkat Subramaniam

Monitoring and Managing a JVM

COMMMUNICATING COOPERATING PROCESSES

Replication on Virtual Machines

Lecture 6: Semaphores and Monitors

CIS 551 / TCOM 401 Computer and Network Security. Spring 2005 Lecture 4

File Transfer And Access (FTP, TFTP, NFS) Chapter 25 By: Sang Oh Spencer Kam Atsuya Takagi

Transcription:

recap Operating Systems and Networks How OS manages multiple tasks Virtual memory Brief Linux demo Lecture 04: Introduction to OS-part 3 Behzad Bordbar 47 48 Contents Dual mode API to wrap system calls Why do we use API? Various types of system calls process=/=program states of a process Critical section Message passing model Shared memory Recap 49 50 system calls provide an interface to the services made available by an operating system. What language: are System-call written in? typically C and C++ and sometimes assemblylanguage involved explain the system calls for reading data from one file and writing to another file: $cp file1 file2 open file1, possible error(print, abort), create file2 (file2 exists, rewrite/rename ), start read and write (errors:disk space, memory stick unplugged ), all read and written, close files, ack 51 Do I access system call directly? system calls: API to wrap system calls Application Programming Interface (API) specifies a set of functions that are available to an application programmer, including the parameters that are passed to each function and the return values the programmer can expect. programmer accesses an API via a library of code provided by the operating system. 1. Windows API for Windows systems Example: CreateProcess() which invokes the NTCreateProcess() system call in the Windows kernel return value 0 or 1 (error) 52

system calls: API (continue) 2. POSIX API for POSIX-based systems (UNIX, Linux, and Mac OS X) programmer accesses an API via a library of code provided by the operating system. Example: read input: int fd: file descriptor to be read void *buf: pointer into buffer to be read into size_t count: maximum number of bytes to read output: number of bytes read (if success) -1 if fail UNIX and Linux for programs written in the C language, the library is called libc. 53 system calls: API (continue) 3. Java API for programs that run on the Java virtual machine. getparentfile() invoked on a file object. output: Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory. JVM uses the OS system calls. 54 why do we use API? Why not invoking actual system calls directly? Program portability: program can compile and run on any system that supports the API system calls can often be more detailed and difficult to work with give access to high level objects (java API) Do you know interfaces in java? using system calls is like implementing an (or many) interfaces 55 What happens when a user prog. makes a system call caller only needs to know the signature! method call and parameters are passed into a registers values saved in memory for example on table or stacks but addresses in registers Stack is preferred because do not put limit on the number of parameters stored. 56 Different types of system call System call: process control process control file manipulation device manipulation information maintenance communications protection. 57 process =/= program an instance of a running program (two process can be associated to the same program). end, abort load, execute create process, terminate process get process attributes, set process attributes wait for time wait event, signal event allocate and free memory We will discuss some of these. 58

end and abort Stopping a running program: normal: end() abnormally: abort(). abnormally: division to zero, file not available: a dump of memory is created for debugging (code has problem) finding cause (unauthorised access) Exercise: read about stdout and stderr load(), execute(), createprocess() $firefox will result in loading of firefox from another program (terminal) Two issues what happens when loading program terminates? should I keep the current program running? (backgroud program &) 59 60 Creating and managing processes If we create a process we can control its execution getting attributes setting attributes maximum allowable execution time terminate process if we find that it is incorrect or is no longer needed wait for an event to happen wait_event() and take action signal_event() 61 Critical section this file is being modified by another program! Critical section: two or more process access the same data one must access at a time operating systems often provide system calls allowing a process to lock shared data. Then, no other process can access the data until the lock is released. acquire_lock() and release_lock() Hard topic: semaphore and monitors 62 File Management create file, delete file open, close read, write, reposition get file attributes, set file attributes Device management process may need multiple resources to execute: Example: access to particular disk request device, release device read, write, reposition get device attributes, set device attributes logically attach or detach devices 63 64

Information maintenance get time or date, set time or date get system data, set system data get process, file, or device attributes set process, file, or device attributes Communications How does two process communicate? message-passing model shared-memory model 65 66 message-passing model Java program (one process) connecting a database (second process) to read/write data (JDBC) Before message, a connection must be opened. Naming: host id and id of the process running on the host Connection created and open() permission for communication to take place with an accept connection() call. processes involved are called client and server read_message() and write_message() system calls. close_connection() sys. call terminates communication. 67 shared memory shared black board model processes gain access and read and write to a shared part of memeory operating system prevent one process from accessing another process s memory. For shared memory two or more processes agree to remove this restriction. Who ensures two process do not read and write same location simultaneously: the two processes. Thread (thread =/= process =/= program) 68 Communications No matter shared-memory or messagepassing, the following system calls are supported: create, delete communication connection send, receive messages transfer status information attach or detach remote devices protection mechanism for controlling access to the resources: file, devices, processes, Mostly designed around access control (remember practical lecture) get permission set permission allow_user deny_user 69 70

system program vs applications System programs (utilities) convenient environment for program development and execution interfaces to system calls Examples: File management. Status information File modification. Programming-language support system program vs applications OS are often supplied with applications : programs that are useful in solving common problems or performing common operations. Example: database, compiler, game 71 72 summary various types of system call Process and differences between process and program stack and heap process state and control block now we know what is saved when switching context. 73