4061_21

Course: CSCI 4061, Fall 2008
School: Minnesota
Rating:
 
 
 
 
 

Document Preview

Session 4061 21 (4/3) Today Thread Synchronization Condition Variables Monitors Read-Write Locks Todays Objectives Explain the difference between mutual exclusion and synchronization Describe the purpose of a condition variable, and the operations permitted on a condition variable Use condition variables and mutex to solve the producer-consumer problem Explain the purpose of a monitor Describe the...

Register Now

Unformatted Document Excerpt

Coursehero >> Minnesota >> Minnesota >> CSCI 4061

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Session 4061 21 (4/3) Today Thread Synchronization Condition Variables Monitors Read-Write Locks Todays Objectives Explain the difference between mutual exclusion and synchronization Describe the purpose of a condition variable, and the operations permitted on a condition variable Use condition variables and mutex to solve the producer-consumer problem Explain the purpose of a monitor Describe the readers and writers problem List some trade-offs between using strong reader synch and strong writer synch 1 Admin Dewayne Many scholarship opportunities Quiz 4 Read Chap 13-14 (thread synchronization) Last Time Mutual Exclusion How do I protect a shared resource from concurrent access? Implementation of mutex (a few ways) POSIX mutex On to Synchronization So, we can protect resources, now we want to have threads coordinate For example, we might want to wait for events to happen Or we want to execute unless we detect some program state 2 Lets Look at Common Sync Mechanisms Condition Variable (+mutex) Block, conditionally Monitor High-level synchronization for programming happiness Read-write lock Conditionally allow parallelism Semaphore More general version of mutex Producer-Consumer Problem A.k.a. the Bounded Buffer Problem A classic problem used to study synchronization Two threads share a common, fixed-size buffer. Producer thread fills the buffer Consumer thread takes information from the buffer Producer-Consumer Problem (2) Problems Producer wants to add an item to a full buffer Consumer wants to remove an item from an empty buffer Conceptual Solution Producer should go to sleep if buffer is full, consumer wakes up producer after next item taken (similar for empty buffer) 3 Solving Producer-Consumer, Step1 Introduce some new calls: sleep() wakeup(otherThread) If you cannot take action, sleep If you complete an action that you think another thread might be waiting for, issue a wakeup Producer-Consumer Problem with Race Condition 4 Lost Wakeup Problem A wakeup sent to a process that is not yet sleeping is lost, not accumulated Mutex to the Rescue? What about this? if (count > 0) { pthread_mutex_lock(&lock); remove() count = count - 1; pthread_mutex_unlock(&lock); } Or, perhaps while (count == 0) /* spin */ ; pthread_mutex_lock(&lock); remove(); count = count - 1; pthread_mutex_unlock(&lock); Condition Variables What if you could do this? pthread_mutex_lock(&lock); while (count == 0) pthread_cond_wait(&nonzero, &lock); count = count - 1; pthread_mutex_unlock(&lock); Condition variables allow to you sleep And you release the mutex so that you dont block others 5 CVs (2) Once you declare a condition variable, you may perform two (primary) operations on that variable wait causes the thread to block on the condition variable, and automatically release the mutex it holds. On return from the function, the thread once again holds the mutex. signal unblock at least one of the threads that are blocked on the specified condition variable cond (if any threads are blocked on cond) Producer Consumer Problem Solved with Mutex+CV mutex m; cond full, empty; void insert(int i) { lock(m); if (count==N) wait(full); put(i); count++; if (count==1) signal(empty); unlock(m); } int remove() { /* todo */ } Monitors Notice, in the last solution, we wished to lock at the beginning of the function and unlock at the end Common practice Can be baked into the programming language 6 Monitors (2) A monitor is a set of procedures Each monitor procedure: Acquires a monitor-wide lock before doing anything else Holds the lock until it finishes or waits for a condition Implemented using mutex Producer Consumer Problem Solved with Monitors Synchronization in Java Monitors + CVs Use the synchronized keyword in a method declaration. public synchronized int foo() { /* only one thread in here */ } You can also use synchronized statements (very similar) 7 Synchronization in Java (2) It is not possible for two invocations of synchronized methods/statements on the same object to interleave constructors cannot be synchronized Synchronization in Java (3) Thre...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Minnesota - CSCI - 4061
4061 Session 21 (4/3)Today Thread Synchronization Condition Variables Monitors Read-Write LocksTodays Objectives Explain the difference between mutual exclusion and synchronization Describe the purpose of a condition variable, and the opera
Minnesota - CSCI - 4061
4061 Session 23 (4/10)Today Reader/Writer Locks and Semaphores Lock FilesTodays Objectives Describe semaphores and reader/writer locks Pseudo-code a barrier using synchronization primitives Write multi-process code that coordinates file writ
Minnesota - CSCI - 4061
4061 Session 23 (4/10)Today Reader/Writer Locks and Semaphores Lock FilesTodays Objectives Describe semaphores and reader/writer locks Pseudo-code a barrier using synchronization primitives Write multi-process code that coordinates file writ
Minnesota - CSCI - 4061
4061 Session 24 (4/12)Today Finish up File Locking Select and Poll Asynchronous I/OTodays Objectives Write single-threaded code that monitors multiple file descriptors concurrently or asynchronously1Admin Readings: Today were going back
Minnesota - CSCI - 4061
4061 Session 24 (4/12)Today Finish up File Locking Select and Poll Asynchronous I/OTodays Objectives Write single-threaded code that monitors multiple file descriptors concurrently or asynchronouslyAdmin Readings: Today were going backwar
Minnesota - CSCI - 4061
4061 Session 25 (4/17)Today Briefly: Select and Poll Layered Protocols and the Internets Intro to Network ProgrammingTodays Objectives Understand enough networking to get going with sockets programming Compare Berkeley Sockets with other for
Minnesota - CSCI - 4061
4061 Session 25 (4/17)Today Briefly: Select and Poll Layered Protocols and the Internets Intro to Network ProgrammingTodays Objectives Understand enough networking to get going with sockets programming Compare Berkeley Sockets with other for
Minnesota - CSCI - 4061
4061 Session 26 (4/19)Today Network security Sockets: building a serverTodays Objectives Name several risks associated with developing network software Explain buffer overflow attack Write a network server in C that implements a simple proto
Minnesota - CSCI - 4061
4061 Session 26 (4/19)Today Network security Sockets: building a serverTodays Objectives Name several risks associated with developing network software Explain buffer overflow attack Write a network server in C that implements a simple proto
Minnesota - CSCI - 4061
4061 Session 27 (4/23)Today Virtual Machines and EmulationTodays Objectives Understand some of the challenges and applications of virtual machinesAdmin My office hours on Wednesday cancelled HW 5: Due day of final Quiz 5: Last day of class
Minnesota - CSCI - 4061
Operating Systems of The Future ( and Plan 9 )Shilad Sen April 26th, 2007Todays Topics Design our own world-dominating OS. Discuss Plan 9, an OS that many people thought should have dominated the world.2Design a Better OS Hypothetical Ques
Minnesota - CSCI - 4061
Operating Systems of The Future ( and Plan 9 )Shilad Sen April 26th, 2007Todays Topics Design our own world-dominating OS. Discuss Plan 9, an OS that many people thought should have dominated the world.2Design a Better OS Hypothetical Ques
Minnesota - CSCI - 4061
4061 Session 29 (5/1)Today Review, Looking Ahead DRM Teaching/TAing evaluations1Admin TCLUG Networking opportunity First meeting in a year.good time to start Tomorrow, this room, 6:30pm - 8:00pm Learn about linux on a flash drive + food
Minnesota - CSCI - 4061
4061 Session 29 (5/1)Today Review, Looking Ahead DRM Teaching/TAing evaluationsAdmin TCLUG Networking opportunity First meeting in a year.good time to start Tomorrow, this room, 6:30pm - 8:00pm Learn about linux on a flash drive + food/dr
Minnesota - CSCI - 4061
CS 4061 Quiz 1 Study Guide and Practice Questions You are responsible for understanding: Lectures, through session 4 (Thurs, Jan 25) Assigned readings (including Robbins sections 1-2.3, and online readings) Lab 1, Homework 1Concepts, Terms, Know
Minnesota - CSCI - 4061
3. System calls require access to resources that are controlled by the OS. Regular function calls do not. System calls perform context switches whereas function calls dont. 4. A bit called the mode bit is added to the hardware of the computer to indi
Minnesota - CSCI - 4061
Name: Student ID: Section:CSCI 4061, Spring 2007 Quiz 1 Instructions: This quiz is open book and notes. No electronic aides (e.g. calculators, cell phones, laptop computers) are allowed. Please write neatly: if we cant read it, we wont give you poi
Minnesota - CSCI - 4061
CS 4061 Quiz 2 Study Guide and Practice Questions You are responsible for understanding: Lectures, through session 10 (Thurs, Feb 16) Code shown in lectures through session 10 Assigned readings (esp. Robbins chapters 3-4) Labs, through lab 4Con
Minnesota - CSCI - 4061
CS 4061 Quiz 2 Practice Quiz Practice Quiz 1. I execute a UNIX grep command to recursively search through a directory structure for the text 4061 on a machine with 2GB of memory. The directory structure contains about 200 MB of files, and resides on
Minnesota - CSCI - 4061
Name: Student ID: Section:CSCI 4061, Spring 2007 Quiz 2Instructions: This quiz is open book and notes. No electronic aides (e.g. calculators, cell phones, laptop computers) are allowed. Please write neatly: if we cant read it, we cant give you po
Minnesota - CSCI - 4061
CS 4061 Quiz 3 Study Guide Understanding that were in the midst of midterms, quiz 3 will have a slightly smaller scope than the other quizzes. The focus will be on files (Robbins chap 5) and pipes (Robbins chap 6). You are responsible for understandi
Minnesota - CSCI - 4061
CS 4061 Quiz 3 Practice Questions Practice Quiz 1. Imagine a system where inodes each occupy 128 bytes of disk space. 64 of these bytes contain status information, 56 bytes are used by direct pointers, and 8 bytes for a single indirect pointer. Point
Minnesota - CSCI - 4061
Name: Student ID: Section:CSCI 4061, Spring 2007 Quiz 3Instructions: This quiz is open book and notes. No electronic aides (e.g. calculators, cell phones, laptop computers) are allowed. Please write neatly: if we cant read it, we cant give you po
Minnesota - CDA - 4102
SEED 4102: TEACHING AND LEARNING STRATEGIES 8:00-11:30 Monday; 12:30-4:00 Monday; or 12:30-4:00 Tuesday, Education Building FALL 2008INSTRUCTORS Michelle Page Carrie Jepma OFFICE HOURS As posted on office doors and by appointment. TEXTS Weinstein,
Minnesota - CDA - 4102
Page Number Changes for SeEd 4102 DATE September 8/9 Monday/ Tuesday NO CLASS 9/1 AND 9/2 LABOR DAY AND OBSERVING IN SCHOOLS September 15/16 TOPICS OF DISCUSSION Introductions, Community Building Nature of the Program Role of Learning Theory Planning
Minnesota - CDA - 4102
SeEd 4102: TEACHING AND LEARNING STRATEGIES PEER TEACHING I REFLECTION Reflect in writing on your lesson and follow-up. Consider the following: 1. How effectively did the lesson teach your objectives?2. What activities or aspects of the lesson desi
Minnesota - CDA - 4102
TEACHING STRATEGIES PEER TEACHING SCORING RUBRIC Your instructor will use this form to provide feedback on your lesson. A grade cannot be assigned until all portions of the assignment are complete (lesson plan, teaching, and reflection). LESSON PLAN
Minnesota - CDA - 4102
INSTRUCTIONAL MODELS PRESENTATION PEER TEACHING SCORING RUBRIC The purpose of this assignment is for you to gain experience in planning and implementing the teaching strategy listed. Your peer teaching will be evaluated based on the following criteri
Minnesota - CDA - 4102
INSTRUCTIONAL MODELS DISCOVERY LEARNING PEER TEACHING SCORING RUBRIC The purpose of this assignment is for you to gain experience in planning and implementing the teaching strategy listed. Your peer teaching will be evaluated based on the following c
Minnesota - CDA - 4102
INSTRUCTIONAL MODELS DIRECT INSTRUCTION PEER TEACHING SCORING RUBRIC The purpose of this assignment is for you to gain experience in planning and implementing the teaching strategy listed. Your peer teaching will be evaluated based on the following c
Minnesota - CDA - 4102
INSTRUCTIONAL MODELS DISCUSSION PEER TEACHING SCORING RUBRIC The purpose of this assignment is for you to gain experience in planning and implementing the teaching strategy listed. Your peer teaching will be evaluated based on the following criteria:
Minnesota - CDA - 4102
INSTRUCTIONAL MODELS CONCEPT ATTAINMENT PEER TEACHING SCORING RUBRIC 1 Selected an important abstract or concrete concept for lesson Used clear prototypes of positive examples for the concept Allowed for substantial student hypothesizing to explore a
Minnesota - CDA - 4102
INSTRUCTIONAL MODELS COOPERATIVE LEARNING-STAD PEER TEACHING SCORING RUBRIC 1 Used presentation strategy to gain student attention Told students what they will learn and what they should be able to do after learning Related new information to ideas l
Minnesota - CDA - 4102
SeEd 4102: Teaching and Learning Strategies Peer Teaching II Reflection NAME_ Reflect on your peer teaching, view your videotape, and review the comments from your peers and teacher. Answer the following items. Attach feedback evaluations to this she
Minnesota - CDA - 4102
CLASSROOM MANAGEMENT PEER TEACHING SCORING RUBRIC Your instructor will use this form to provide feedback on your lesson. A grade cannot be assigned until all portions of the assignment are complete (lesson plan, teaching, and reflection). LESSON PLAN
Minnesota - CDA - 4102
EVALUATION: ANALYSIS OF STUDENT LEARNINGDuring the practicum, students will conduct an analysis of student learning on at least one lesson that they teach. Each student will need to create a lesson plan conduct a pre-assessment (assessing what stu
Minnesota - CDA - 4102
UNIT PLAN PROJECTPurpose of the assignment: This is an opportunity for you to demonstrate your skill at planning coherent units and lessons in your subject area. Specifically, you will consider how to incorporate best practices, make modifications,
Minnesota - CDA - 4102
SEED 4102: TEACHING AND LEARNING STRATEGIES UNIT PLAN EVALUATION Name: _ Essential and Unit Questions 1 2 3 Essential and unit Essential and unit questions are not agequestions are missing or appropriate OR are not meet none of the criteria compellin
Minnesota - CDA - 4102
BRAINSTORMING AND PLANNING TOOL: CLASSROOM MANAGEMENT MODEL NOTES What type of environment do I want to create in my classroom or what types of skills and behaviors do I want to develop in my students? What is my general approach?How will I arrange
Minnesota - CDA - 4102
Block II Take Home Assignment Classroom Management 1. What is the difference between discipline and classroom management?2. Many teachers believe that preventing misbehavior is one of the most important parts of a classroom management plan. What do
Minnesota - CDA - 4102
WHERE WE ARE HEADING: AUTHENTIC ASSESSMENTPERFORMANCEASSESSMENTIf we want students to analyze, interpret, synthesize, and evaluate information, we must assess those skills in a meaningful context.PURPOSE OF AUTHENTIC ASSESSMENTTO HAVE STUDENTS
Minnesota - CDA - 4102
ACTION RESEARCH/INQUIRY PLANNER (5 points)ACTION RESEARCH/INQUIRY PROBLEM/QUESTION1) Specific question to be investigated. State as one sentence.2) Sub-Questions to investigate. Begin with who, when what, where, why, how questionsExample: 1)
Minnesota - CDA - 4102
ACTION RESEARCH/INQUIRY SCORING RUBRICORAL SHARINGDESCRIBED PROBLEM/ISSUE12345x 1 _EXPLAINED TERMS/ASSUMPTIONS12345x1_EXPLAINED REASONS FOR CHOOSING 12345x1_DISCUSSED MAJOR SOURCES12345x1_DESC
Minnesota - CDA - 4104
SEED 4104: TEACHING DIVERSE LEARNERS 8:00-11:40 AM Tuesdays, HFA 6 FALL 2008Instructor: Michelle Page Office Hours: Monday 3:15-4:15 PMOffice: Education Bldg., room 108Phone: 589-6405E-mail: pagem@morris.umn.eduTuesday 1PM-3PMandBy Appo
Minnesota - CDA - 4104
Portfolio Scoring RubricStandard: 1 2 3 4 5 6 7 8 9 10Statement of Knowledge 1 2 3 4 5 Score Well written Lacks detail in Statement of paragraph(s) that explanations or does knowledge lacks describe what the not describe one detail and reflection
Minnesota - CDA - 4104
Evaluation: Connections JournalThis journal may be kept in a notebook in journal form or be typedwhichever is easier for you. In this journal, you will reflect upon the weekly readings and attempt to draw connections between the readings and your d
Minnesota - CDA - 4104
Scoring Rubric for Family Communication Brochure or Newsletter This assignment is meant to showcase your use of technology and your communication skills in working with parents and families. Your assignment is to create a brochure or newsletter, usin
Minnesota - CDA - 4104
Evaluation: Differentiated LessonUsing what you have learned about differentiating instruction, take three lessons that you have taught in your practicum and re-create them as differentiated lessons. You must differentiate for each one of these: lea
Minnesota - CDA - 4104
Evaluation: Cultural Reading ProjectTogether with others who read the same book, present your choice book, paying particular attention to issues of diversity and schooling and what you have learned about people different from yourself. Your presenta
Minnesota - CDA - 4104
NO CHILD LEFT BEHIND -2001 ESEA -2001MINNESOTA DEPARTMENT OF EDUCATIONGOAL OF NCLB TO HAVE EVERY STUDENT ACHIEVE PROFICIENCY IN READING, MATH AND SCIENCE BY THE YEAR 2014.CORNERSTONE OF NCLB The state will hold schools and districts accountabl
Minnesota - CDA - 4104
Foundations of SchoolingIf its a school day, onefifth of the total American population consists of public school students k12.The Common School 17701900Funded by local property taxes Charged no tuition Was open to all white children Was governed
Minnesota - CDA - 4104
Minnesota - CDA - 4105
SEED 4105: READING AND LITERACY IN THE CONTENT AREAS 8:00-11:30 AM Tuesdays, HFA 6 FALL 2008Instructor: Michelle Page Office Hours: Monday 3:15-4:15 PMOffice: Education Bldg., room 108Phone: 589-6405E-mail: pagem@morris.umn.eduTuesday 1PM-3
Minnesota - CDA - 4105
Portfolio Scoring RubricStandard: 1 2 3 4 5 6 7 8 9 10Statement of Knowledge 1 2 3 4 5 Score Well written Lacks detail in Statement of paragraph(s) that explanations or does knowledge lacks describe what the not describe one detail and reflection
Minnesota - CDA - 4105
Evaluation: Text Set A text set is a collection of readings that are organized along a theme. The idea of the text set is to provide accessible, readable text to students that is not from a textbook. A text set should: contain a wide variety of writt
Minnesota - CDA - 4105
Evaluation: Strategies Presentations You will do two demonstrations of literacy strategies during this course. First, with a partner, you will conduct a vocabulary learning presentation. You may choose any sample text. You will briefly model how a te
Minnesota - CDA - 4105
Content Reading and Literacy:Overview and ContextWhat is reading? A complex, purposeful, social and cognitive process in which readers simultaneously use their knowledge of spoken and written language, their knowledge of the topic of the text, an
Minnesota - CDA - 4105
StudentJaneDoe TEXTSETJaneAustenforRealPeople ReadingandLiteracyintheContentAreas ProfessorPage October24,2007 JaneAustenforRealPeople Whentryingtothinkofatopicforacreative,useful,andfuntextset,Iwassomewhatbesidemyself.Of course,forEnglishmajors,thi
Minnesota - CDA - 4105
Thistextsetisdesignedasasupplementalresourceforageometrycoursefor secondarystudents.Itcontainsavarietyoftextsrelatedtogeometryinsomeway,including applicationsofgeometryandtextsaboutgeometers.Itisdesignedtoprovidematerials accessibletostudentsatawide
Minnesota - CDA - 4105
Student John Doe Text Set October 16, 2007 Predecessors of Modern Instruments Text Set Theme: The theme of this text set is on the predecessor of the modern day Trombone, the Sackbut. This text set is set up to be for high school aged students. This
Minnesota - CDA - 4105
Student John Doe October 24, 2007 SeEd 4105Michelle Page Text Set The following is an annotated bibliography of a text set that I have chosen to use for instructing a unit on World War II, in a 10th grade Accelerated U.S. History course. I believe th