CS 241 Section (03/15/2012). MP6 This MP is simple: – Create a ‘make’ utility.

Slides:



Advertisements
Similar presentations
Programming project #2 1 CS502 Spring 2006 Programming Project #2 CS-502 Operating Systems Spring 2006.
Advertisements

CS162B: POSIX Threads Jacob Chan. Objectives ▪ Review on fork() and exec() – Some issues on forking and exec-ing ▪ POSIX Threads ▪ Lab 8.
More about Shells1-1 More about Shell  Shells (sh, csh, ksh) are m Command interpreters Process the commands you enter m High-level programming languages.
Critical Sections and Semaphores A critical section is code that contains access to shared resources that can accessed by multiple processes. Critical.
1 Processes and Pipes COS 217 Professor Jennifer Rexford.
Fall 2007CS 2251 Programming Tools Eclipse JUnit Testing make and ant.
Programming project #4 1 CS502 Spring 2006 Programming Project #4 Web Server CS-502 Operating Systems Spring 2006.
Project #3, Threads and Synchronization CS-3013 A-term Project #3 Threads and Synchronization CS-3013, Operating Systems A-term 2009 Due Tuesday,
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
CS-3103 & CS-502, Summer 2006 Programming Project #31 Programming Project #3 Web Server CS-3103 & CS-502 Operating Systems.
Scheduler Activations Jeff Chase. Threads in a Process Threads are useful at user-level – Parallelism, hide I/O latency, interactivity Option A (early.
The Programming Interface. Main Points Creating and managing processes – fork, exec, wait Performing I/O – open, read, write, close Communicating between.
Chapter 4: Threads Adapted to COP4610 by Robert van Engelen.
CS 241 Section Week #4 (2/19/09). Topics This Section  SMP2 Review  SMP3 Forward  Semaphores  Problems  Recap of Classical Synchronization Problems.
CS252: Systems Programming Ninghui Li Final Exam Review.
Nachos.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Threads A thread (or lightweight process) is a basic unit of CPU.
Nachos Phase 1 Code -Hints and Comments
Introduction to Processes CS Intoduction to Operating Systems.
Project 1, Command Shell CS-502 (EMC) Fall Programming Project #1 Command Shell CS-502, Operating Systems EMC, Fall 2009 (Slides include materials.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
The University of Adelaide, School of Computer Science
Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises.
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
CS345 Operating Systems Threads Assignment 3. Process vs. Thread process: an address space with 1 or more threads executing within that address space,
What is a thread? process: an address space with 1 or more threads executing within that address space, and the required system resources for those threads.
CS 241 (03/07/12). MP #5 Exam Reminders  We still have a few students that still need to take the conflict.  Thanks for not discussing it on Piazza.
CS333 Intro to Operating Systems Jonathan Walpole.
Lecture 8 Page 1 CS 111 Online Other Important Synchronization Primitives Semaphores Mutexes Monitors.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Processes and Threads.
1 Pthread Programming CIS450 Winter 2003 Professor Jinhua Guo.
Lecture 5 Barriers and MPI Introduction Topics Barriers Uses implementations MPI Introduction Readings – Semaphore handout dropboxed January 24, 2012 CSCE.
Pthreads.
2.3 interprocess communcation (IPC) (especially via shared memory & controlling access to it)
1 OS Review Processes and Threads Chi Zhang
CSC 360, Instructor: Kui Wu Thread & PThread. CSC 360, Instructor: Kui Wu Agenda 1.What is thread? 2.User vs kernel threads 3.Thread models 4.Thread issues.
Homework Assignment #1 J. H. Wang Oct. 11, 2013.
PThread Synchronization. Thread Mechanisms Birrell identifies four mechanisms commonly used in threading systems –Thread creation –Mutual exclusion (mutex)
Project 3. “System Call and Synchronization” By Dongjin Kim
Implementing Processes and Threads CS550 Operating Systems.
CS 241 Discussion Section (02/02/2012). MP2 Overview  Task is simple  Reimplement malloc(), calloc(), realloc() and free()  A contest will be running.
CS241 Systems Programming Discussion Section Week 2 Original slides by: Stephen Kloder.
CS241 Systems Programming Discussion Section Week 2 Original slides by: Stephen Kloder.
Working with Pthreads. Operations on Threads int pthread_create (pthread_t *thread, const pthread_attr_t *attr, void * (*routine)(void*), void* arg) Creates.
Case Study: Pthread Synchronization Dr. Yingwu Zhu.
Tutorial 4. In this tutorial session we’ll see Threads.
Tutorial 2: Homework 1 and Project 1
CSCI 4061 Recitation 2 1.
PROCESS MANAGEMENT IN MACH
Chapter 5: Process Synchronization – Part 3
Chapter 5: Process Synchronization – Part II
CS 3340 Windows Programming
Threads in C Caryl Rahn.
Boost String API & Threads
CS399 New Beginnings Jonathan Walpole.
Chapter 4: Threads.
CS 3305 System Calls Lecture 7.
Multithreading Tutorial
Cs561 Presenter: QIAOQIAO CHEN Spring 2012
CS510 Operating System Foundations
Programming Project #1 Command Shell
Tutorial: The Programming Interface
Programming Project #1 Fork and Command Shell
Jonathan Walpole Computer Science Portland State University
Thread Synchronization including Mutual Exclusion
Concurrency: Processes CSE 333 Summer 2018
Tutorial 4.
EECE.4810/EECE.5730 Operating Systems
CSE 451 Section 1/27/2000.
Chapter 3: Process Management
Presentation transcript:

CS 241 Section (03/15/2012)

MP6 This MP is simple: – Create a ‘make’ utility.

MP6 This MP is simple: – Create a ‘make’ utility. What does ‘make’ do? – Reads a ‘makefile’ – Determines the tasks that are available to run based on dependency rules – Run until all tasks are finished

MP6 job1: job2 job3 commandtoberun withargs commandtoberun2 withargs job2: othercommand job3: finalcommand

MP6 job1: job2 job3 commandtoberun withargs commandtoberun2 withargs job2: othercommand job3: finalcommand target

MP6 job1: job2 job3 commandtoberun withargs commandtoberun2 withargs job2: othercommand job3: finalcommand dependencies

MP6 job1: job2 job3 commandtoberun withargs commandtoberun2 withargs job2: othercommand job3: finalcommand commands

MP6 We can show this graphically: …job1 depends on job2 and job3 being done. job2 job3 job1

MP6 In MP6, you will specify (with the –j # option) how many worker threads should run. – “-j 1”: Only one worker thread – “-j 2”: Two worker threads – “-j 100”: One hundred worker threads Use getopt() to handle command-line options

MP6 If the makefile is ran with –j 2, then: [thread a]: job2 runs [thread b]: job3 runs [thread b]: job3 finishes [thread b]: idle, job1 not ready [thread a]: job2 finishes [thread a OR b]: job1 runs [thread a OR b]: job1 finishes [thread a AND b]: exit, all jobs done [main thread]: join threads, exit

MP6 We provide you some tools you can use, if you’d like: – queue.c: A queue data structure – parser.c: A parser for makefiles parser_parse_makefile(…) takes function pointers as arguments that will be called when it reaches a key, dependency, or command.

MP6 Parser Callbacks parsed_new_key(key=job1) parsed_dependency(key=job1, dep=job2) parsed_dependency(key=job1, dep=job3) parsed_command(key=job1, command=...) parsed_new_key(key=job2) parsed_command(key=job2, command=...) parsed_new_key(key=job3) parsed_command(key=job3, command=...)

MP6 Some useful functions: – pthread_create(), pthread_join() – sem_init(), sem_wait(), sem_post(), sem_destroy() – system() Does fork(), exec(), and wait() for you in one command! Remember to check return values! You may find some weird things going on with semaphores if you don’t… Good luck!

MP6 Run a rule only if any dependency has a modification time more recent than the target. You can get the modification time of a file using stat()

Coding Examples This week: ds/ds6/