CS 300 Leftovers. CS460 Pacific University 1

Similar documents
The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

CS370 Operating Systems

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

Chapter 2: Operating-System

Chapter 2: System Structures

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

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

Chapter 2: Operating-System Structures

Chapter 2. Operating-System Structures

Chapter 2: Operating-System Structures

Chapter 2: Operating-System Structures

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

Chapter 2: Operating-System Structures

Chapter 2 Operating-System Structures

OS Structures. ICS332 Operating Systems

Lecture 03 Bits, Bytes and Data Types

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

Operating System Structure

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

Chap2: Operating-System Structures

CS420: Operating Systems

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

Operating System Structure

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

CS420: Operating Systems. OS Services & System Calls

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

What are some common categories of system calls? What are common ways of structuring an OS? What are the principles behind OS design and

Module 1 Introduction/OS Overview

CS307: Operating Systems

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

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

Operating System Architecture. CS3026 Operating Systems Lecture 03

Operating-System Structures

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester

Lecture 2 Operating System Structures (chapter 2)

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

Chapter 2: Operating-System Structures

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4

4.8 Summary. Practice Exercises

OS lpr. www. nfsd gcc emacs ls 9/18/11. Process Management. CS 537 Lecture 4: Processes. The Process. Why Processes? Simplicity + Speed

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

Threads. CS-3013 Operating Systems Hugh C. Lauer. CS-3013, C-Term 2012 Threads 1

Operating System Concepts Ch. 2: Operating System Structures

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

CS 3305 Intro to Threads. Lecture 6

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

CSE 4/521 Introduction to Operating Systems

Operating-System Structures

Operating System Services. User Services. System Operation Services. User Operating System Interface - CLI. A View of Operating System Services

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

Operating Systems and Networks Assignment 9

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction to Supercomputing

CSE 351. Introduction & Course Tools

Introduction of Linux

TDDI04, K. Arvidsson, IDA, Linköpings universitet Operating System Structures. Operating System Structures Overview. Operating System Services

Introduction to Linux

CS510 Operating System Foundations. Jonathan Walpole

Sep 12, 2006 Lecture 2: System Programming

CSE 333 SECTION 3. POSIX I/O Functions

PRINCIPLES OF OPERATING SYSTEMS

Problem Set 1: Unix Commands 1

Chapter 2 Operating System Structures

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits

Thread Concept. Thread. No. 3. Multiple single-threaded Process. One single-threaded Process. Process vs. Thread. One multi-threaded Process

CS333 Intro to Operating Systems. Jonathan Walpole

Multithreaded Programming

Questions answered in this lecture: CS 537 Lecture 19 Threads and Cooperation. What s in a process? Organizing a Process

Chapter 2: OS Structures

Processes. Johan Montelius KTH

CS 390 Chapter 2 Homework Solutions

Four Components of a Computer System

A process. the stack

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

Chapter 3: Operating-System Structures

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze

What is a Process? Processes and Process Management Details for running a program

Chapter 3: Operating-System Structures

Often, more information is required when designing system call Information varies according to OS and types of system call

628 Lecture Notes Week 4

Introduction to Linux. Fundamentals of Computer Science

The Process Abstraction. CMPU 334 Operating Systems Jason Waterman

COS 318: Operating Systems

OS Structure, Processes & Process Management. Don Porter Portions courtesy Emmett Witchel

Computer Labs The Minix 3 Operating System

CS153: Process 2. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian

Programming in C. Session 8. Seema Sirpal Delhi University Computer Centre

Processes. CS439: Principles of Computer Systems January 24, 2018

Overview of Unix / Linux operating systems

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

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

Hello, World! in C. Johann Myrkraverk Oskarsson October 23, The Quintessential Example Program 1. I Printing Text 2. II The Main Function 3

File IO and command line input CSE 2451

Introduction to Linux

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed

Chapter 2: System Structures

Laboratory 1 Semester 1 11/12

CSE 153 Design of Operating Systems Fall 2018

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Transcription:

CS 300 Leftovers Pacific University 1

argc/argv The C Programming Language section 5.10, page 114 int main(int argc, char** argv) argc - number of entries in argv argv - array of character pointers containing the arguments argv[0] - the name of the executable argv[1] - the first command line argument./runme argument argc = 2 argv[0] - argv[1] -./runme argument Pacific University 2

man pages manual pages man bash man man man ls also available online: google man bash (may be different than what is on your machine) http://linux.die.net/man/ http://www.kernel.org/doc/man-pages/ Pacific University 3

man pages - Library Function FOPEN(3) Name fopen, fdopen, freopen stream open functions Synopsis #include <stdio.h> FILE *fopen(const char *path, const char *mode); Description (arguments or command line options are listed here) Return Value Errors See Also Referenced By Pacific University 4

manual sections 0 Header files (usually found in /usr/include) 1 Executable programs or shell commands 2 System calls (functions provided by the kernel) 3 Library calls (functions within program libraries) 4 Special files (usually found in /dev) 5 File formats and conventions eg /etc/passwd 6 Games 7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7) 8 System administration commands (usually only for root) 9 Kernel routines [Non standard] p means POSIX! Pacific University 5

chadd@bart:~> man nanosleep Man: find all matching manual pages (set MAN_POSIXLY_CORRECT to avoid this) * nanosleep (2) nanosleep (3p) Man: What manual page do you want? Man: chadd@bart:~> export set MAN_POSIXLY_CORRECT=1 chadd@bart:~> man nanosleep chadd@bart:~> man -S 3p nanosleep OR Add that line to the end of ~/.bashrc Pacific University 6

Kernighan's Law, p 85 "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Pacific University 7

Chapter 2 Operating System Structures Pacific University 8

OS Services User Interface Program Execution I/O Operation File System manipulation Communication Error detection Resource Allocation Accounting Protection/Security Pacific University 9

Command Interpreter Command line Unix Shell C:\ User Interface to the OS GUI Mac Terminal Xerox PARC Often these are application programs and not part of the OS. The true interface to the OS is via system calls Mac OS Windows X-Windows KDE/GNOME Pacific University 10

System Calls Interface to OS (kernel) services Wrapped in API (API =?) POSIX libc.so libgcc.so Win32 Java API why? Pacific University Silberschatz, p 58 11

System Call via Library Linux glibc.so libpthread.so libcap.so Solaris/SunOS libsocket.so Pacific University Silberschatz, p 62 12

Passing data to a system call Registers Systems Calls: Data Block of memory Stack Advantages/ Disadvantages? Pacific University Silberschatz, p 47 13

Process Control How does GDB work? File access Device access Information maintenance Communications Types of System Calls Pacific University 14

Process Control What are some process control system calls? fork() / exec() How does GDB work? the ptrace API what does GDB need to do? Pacific University 15

File Management More System Calls... Device Management How is this different from File Management? When would you use this? Pacific University 16

Information Maintenance Date Time Even More... Communication Message passing pipes Shared memory Networking Pacific University 17

System Utilities System Programs common applications shipped with the OS/kernel not necessarily part of the OS often a wrapper around a system call cp, mv, rm, cat compilers Loaders Pacific University 18

Design Goals Operating System Design Mechanism vs Policies Implementations Assembly vs C advantages/disadvantages? Pacific University 19

OS Structure Simple MS DOS Monolithic Layered Pacific University Silberschatz, p 59, 61 20

Old Unix Really Big Layers Pacific University Silberschatz, p 60 21

Structure Microkernel Mach/MacOS Modular Monolithic with Modules Modern Linux Pacific University Silberschatz, p 63 22

Virtual Machines (VM) Abstract away the hardware Real or imagined hardware Parallels VMWare/Bochs VirtualBox Java VM.Net Pacific University Silberschatz, p 65 23