Lecture 2 Processes & Treads

Lecture 2 Processes & Treads - Administrivia Lab 1 is...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Administrivia Lab 1 is up, Due Thursday, Jan. 21- Due at start of lecture 4:15pm- Free extension to midnight if you come to lecture- Or for SCPD students if you watch lecture that day Ask cs140-staff for extension if you cant finish- Tell us where you are with the project- And how much longer you need to finish No credit for late assignments w/o extension Section tomorrow, 3:15pm (here) 1/45 Processes A process is an instance of a program running Modern OSes run multiple processes simultaneously Examples (can all run simultaneously):- gcc file A.c compiler running on file A- gcc file B.c compiler running on file B- emacs text editor- firefox web browser Non-examples (implemented as one process):- Multiple firefox windows or emacs frames (still one process) Why processes?- Simplicity of programming- Higher throughput (better CPU utilization), lower latency 2/45 Speed Multiple processes can increase CPU utilization- Overlap one processs computation with anothers wait Multiple processes can reduce latency- Running A then B requires 100 sec for B to complete- Running A and B concurrently makes B finish faster- A slightly slower, but less than 100 sec unless A and B both completely CPU-bound 3/45 Processes in the real world Processes, parallelism fact of life much longer than OSes have been around- E.g., say takes 1 worker 10 months to make 1 widget- Company may hire 100 workers to make 10,000 widgets- Latency for first widget >> 1/10 month- Throughput may be < 10 widgets per month (if cant perfectly parallelize task)- Or > 10 widgets per month if better utilization (e.g., 100 workers on 10,000 widgets never idly waiting for paint to dry) You will see this with Pintos- Dont expect labs to take 1/3 time with three people 4/45 A processs view of the world Each process has own view of machine- Its own address space- Its own open files- Its own virtual CPU (through preemptive multitasking) *(char *)0xc000 different in P 1 & P 2 Greatly simplifies programming model- gcc does not care that firefox is running Sometimes want interaction between processes- Simplest is through files: emacs edits file, gcc compiles it- More complicated: Shell/command, Window manager/app. 5/45 Inter-Process Communication How can processes interact in real time? (a) By passing messages through the kernel (b) By sharing a region of physical memory (c) Through asynchronous signals or alerts 6/45 Rest of lecture User view of processes- Crash course in basic Unix/Linux system call interface- How to create, kill, and communicate between processes Kernel view of processes- Implementing processes in the kernel Threads How to implement threads 7/45 UNIX files I/O Applications open files (or devices) by name- I/O happens through open files int open(char *path, int flags, /*mode*/...);- flags : O RDONLY , O WRONLY , O RDWR- O CREAT : create the file if non-existent...
View Full Document

This note was uploaded on 03/13/2010 for the course CS 02523 taught by Professor Davidmieres during the Winter '10 term at A.T. Still University.

Page1 / 50

Lecture 2 Processes & Treads - Administrivia Lab 1 is...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online