# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

2 Pages

### lab6_prodcon_to_complete

Course: WEB 301, Fall 2009
School: St. Xavier
Rating:

Word Count: 223

#### Document Preview

Bounded // buffer problem solution using semaphores pclab6.cm #include &quot;bddbuff.inc&quot; const int ValueRange = 20; // 0-19 will be produced and consumed semaphore to; // exclusive access to output semaphore s; // mutual exclusion for buffer semaphore n; // # consumable items in buffer semaphore e; // # empty spaces in buffer int produce(char id) { int tmp; tmp = random(ValueRange); wait(to); cout...

Register Now

#### Unformatted Document Excerpt

Coursehero >> Illinois >> St. Xavier >> WEB 301

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.
Bounded // buffer problem solution using semaphores pclab6.cm #include "bddbuff.inc" const int ValueRange = 20; // 0-19 will be produced and consumed semaphore to; // exclusive access to output semaphore s; // mutual exclusion for buffer semaphore n; // # consumable items in buffer semaphore e; // # empty spaces in buffer int produce(char id) { int tmp; tmp = random(ValueRange); wait(to); cout << "Producer " << id << " produces " << tmp << endl; signal(to); return tmp; } void consume(char id, int i) { wait(to); cout << "Consumer " << id << " consumes " << i << endl; signal(to); } void producer(char id) { int i; for (;;) { //loop forever - can't use for loop here! i = produce(id); // FILL IN TWO SEMAPHORE OPERATIONS: //FILL append(i); IN TWO MORE SEMAPHORE OPERATIONS: } void consumer(char id) int i; for (;;) { i = take(); //FILL IN TWO MORE SEMAPHORE OPERATIONS: consume(id,i); } } main() { // INITIALIZE EACH SEMAPHORE PROPERLY initialsem(s,?); initialsem(n,?); initialsem(e,?); initialsem(to,?); cobegin { producer('A'); producer('B'); consumer('x'); consumer('y'); consumer('z'); } } } { //loop forever - can't use for loop here! //bddbuff.inc const int SizeOfBuffer = 5; int buffer[SizeOfBuffer]; ...

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:

SUNY Buffalo - CSE - 575
Chapter FourThe Cognitive Approach I: History, Vision, and AttentionWhy a cognitive revolution?Inadequate behaviorist accounts of language acquisition. Reinforcement cannot explain rapid learning of vocabulary and syntax. New tools for measuring
SUNY Buffalo - CSE - 575
Chapter FiveThe Cognitive Approach II: Memory, Imagery, and Problem SolvingMemoryMemory is the capacity to retain information over time. Memory allows us to learn from previous experiences. Memory systems can be characterized by duration, capac
SUNY Buffalo - CSE - 575
Chapter SixThe Neuroscience Approach: Mind As BrainNeuroscienceThe study of nervous system anatomy and physiology in man and other species. Cognitive neuroscience studies the structures and processes underlying cognitive function. What are the
SUNY Buffalo - CSE - 575
Chapter SevenThe Network Approach: Mind as a WebConnectionismThe major field of the network approach. Connectionists construct Artificial Neural Networks (ANNs), which are computer simulations of how groups of neurons might perform some task.
SUNY Buffalo - CSE - 575
Chapter EightThe Evolutionary Approach: Change Over TimeEvolutionary PsychologyEvolutionary Psychology (EP) describes how our early environment produced our current mental abilities. This environment was the the Pleistocene era, approximate
SUNY Buffalo - CSE - 575
Chapter NineThe Linguistic Approach: Language and Cognitive ScienceLinguisticsThe study of language. A variety of theoretical approaches and methodologies. Topics include grammatical rules, animal language, development, and computer speech reco
SUNY Buffalo - CSE - 575
Chapter TenArtificial Intelligence I: Definitional PerspectiveHistorical PerspectiveArtificial Intelligence (AI) has been a driving force behind our quest to create a machine in our own image. Automata begin to appear for general public consump
SUNY Buffalo - CSE - 575
Chapter ElevenArtificial Intelligence II: Operational PerspectiveHistorical PerspectiveMan has long been interested in creating a machine in his own image. Many mechanical dolls were created in the 18th century. Cultural: In the opera &quot;The Tale
SUNY Buffalo - CSE - 575
Chapter TwelveRobotics: The Ultimate Intelligent AgentsDefining Robotic FunctionA mechanical entity that can function autonomously, by which is meant: Without recourse to a human operator. Able to adapt to a changing environment. Continue to
SUNY Buffalo - CSE - 575
Chapter ThirteenConclusion: Where We Go From HereThe benefits of cognitive scienceBrings together diverse theoretical perspectives. Widespread influence of cognitive theory on other disciplines and in education. Practical applications in medici
UNC Charlotte - ETEE - 1101
Course Year_Experiment Title _Name_ Formal(Y/N)_ Date Performed_Date Due_Date Submitted_Much more detail is in the Lab Manual as to content needed. 1. 2. Cover Sheet_(Exp. #, Title, Author(highlighted), Partners, Date performed/due/submitted.) Su
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UNC Charlotte - ETEE - 1101
UCLA - AOS - 105
Lecture 11 Limits to ProductivityLecture 10 summary: Plankton can be categorized according to:Trophic status(autotrophs, etc.)Chemical function(calcification, etc.)Size(picoplankton, etc) Each category has important implications for element
UCLA - AOS - 105
Lecture 19 Remineralization RatesLecture 18 Summary 1) Remineralization is essential to maintaining the marine biosphere because it returns nutrients to seawater. 2) The rates of remineralization will vary with export flux and with depth. 3) The de
University of Texas - ASE - 324
ASE 324L: Aerospace Materials LabLab 3 Homework Prepare a formal lab report, and answer the following questions: Under Experimental and Data Reduction Procedures: 1. Plot the engineering stress-strain diagrams for each specimen. In each plot, compa
Wisconsin - ECON - 101
Economics 101 Summer 2009 Answers to Quiz #2 June 2, 2009Name _ Discussion Section Day and Time _1. Consider the market for bananas. Doctors report that consuming two bananas a day result in significant declines in cancer risk. Simultaneously, pe
Laurentian - MGT - 200401
Mgt 3850 Canadian Business Culture Evening March 16, 2004 Menu Who What (Food) Comments
Laurentian - MGT - 200401
Management 3850N Spring 2004 Group ListGroup 2 Luis Salazar Pablo Aceiton Andrew Rzeszutek Group 4 Jennifer Mundo Rodrigo Castaneda Karolina Sowa Group 6 Diego Adame Tae Young Jeong Mariusz Marciniak Group 8 Ji Hye Lee Hana Jeong Paulina Gomez Group
Laurentian - MGT - 200401
Management 3850 Waterton Park TripFebruary 23, 2004 Itinerary Time 8:30 9:30 9:30 10:00 Event Breakfast Trip Preparation Location Room D475 Room D475 Needs Wavier Forms Lunches Clothing check Cameras Chinook Tours Bathroom Break Discussion of bes
Laurentian - MGT - 200401
Management 3850 Wilson Colony/Hockey Game TripFebruary 27, 2004 Itinerary Time 11:00 Event Trip Preparation Location Sixth Level of University Hall (North Doors) Level 6 University Hall Meet with Judy Short Introduction on the Bus Dining Hall Needs
Laurentian - MGT - 200401
Management 3850N: Introduction to Canadian CultureCourse Outline Spring 2004 Room C - 610 Tuesday 6:00 8:50 pm Instructor Sandy Cahoon Email: cahosl@uleth.ca Office: D443 Class Website WebCT Phone: 329-2632/382-7158 Office Hours: TBA http:/classes
Laurentian - MGT - 200401
Culture &amp; Management Definitions of culture Theoretical frameworks of culture How culture affects managementWhat is culture? For a culture to exist, its members need to have: shared meanings shared understanding shared sense makingCulture C
Laurentian - MGT - 200401
Letter of Consent As a requirement for partial fulfillment of Mgt 3850, a course in Canadian Culture at the University of Lethbridge, students are required to conduct interviews to gather data for a project. Participation in this interview is entirel
University of Texas - ASE - 369
LAB #2: First-Order System Behavior Equipment: Oscilloscope (Tektronix 2211) Digital Multimeter (FLUKE 8050A) Function Generator (Tektronix CFG250) 1.5 V Battery RC BoxObjectives: In this experiment you will learn to use the transient-capture (sing
University of Texas - ASE - 369
LAB #6: Digital Signal ProcessingEquipment: Pentium PC with NI PCI-MIO-16E-4 data-acquisition board NI BNC-2120 Accessory Box VirtualBench Instrument Library version 2.6 Function Generator (Tektronix CFG250) Reference: PCI-MIO-16E-4 product informat
CSU Channel Islands - ICS - 280
ICS 280-Spring 2005 Approximation Algorithms Homework 2 Due: May 24, 2005 1. Consider the following variation of the bin-packing problem. We are given positive integers m, B, and n1 , n2 , . . . , nB . We interpret this as a modified bin packing prob
CSU Channel Islands - ICS - 280
ICS 280-Spring 2005 Approximation Algorithms Homework 3 Due: June 9, 2005 1. Show that if we remove Step 4 in Algorithm 18.4, there is no constant bound on the approximation factor. (This is part of problem 18.5 in the text.) *2. Suppose that, even i
UCLA - CM - 170
Go to http:/www.ncbi.nlm.nih.gov/ Search Genbank for &quot;your accession number&quot; or &quot;your gene of interest&quot;. Let us pretend that your project is for Crd1. Then when you enter the accession number AF237671, here is the result you will get &quot;Query&quot; When you
Duke - BIO - 114
Lab 1: Zooplankton SHOW YOUR WORK MICROSCOPE ID / COUNTING (1) Using the keys provided, draw and identify five different zooplankton and five different phytoplankton in the sample provided. (2) Calculate the total number of zooplankton for the 5 most
Duke - BIO - 114
Lab 2: Phytoplankton SHOW YOUR WORK! BIOMASS (1) Fill in the following table with your data: Sample Fo Fa v V(2) Calculate g Chl a/l and g Phaeo/l your samples and fill in the following chart. Show one representative calculation: Sample g Chl a/l
Duke - BIO - 114
Lab 3: Bacteria / Fish SHOW YOUR WORK! BACTERIA (1) Calculate bacteria cells/ml for your water sample. Report this value to your TA.(2) Two water samples were collected and processed and are available on line. Calculate the variance of the data for
Duke - BIO - 114
Lab 4: Nutrients SHOW YOUR WORK! AMMONIUM (1) Create and attach a standard curve with error bars, regression equation and r2 value. Below calculate the ammonium value for your sample.(2) Is ammonium more abundant in the open ocean or near the coast
Duke - BIO - 114
Lab 5: Physics SHOW YOUR WORK! SECCHI (1) Using a station of your choice and Secchi depth, calculate the diffuse attenuation coefficient of the water column and the depth of the 1% light level.(2) For the above station, construct and attach a graph
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - January 16 PHYSICAL MECHANISMS (1) Diagram using the transmitter, signal modulator, receiver motif one example of how physics influences biology in the oceanographic setting. (2) Consider
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - January 19 OCEANIC / TERRESTRIAL PRODUCTION (1) Compare and contrast oceanic and terrestrial environments in the following categories: size of primary producers, maximum chlorophyll conce
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - January 21 SEAWATER CHEMICAL COMPOSITION (1) What are the major conservative cations and anions present in seawater? List these in order of concentration. (2) Which of these components co
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - January 23 LIGHT (1) What is the relationship between energy and electromagnetic wavelength? (2) Derive the Beer-Lambert law and convert from one form to another. What is the relationship
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - January 26 LIGHT / DARK REACTIONS OF PHOTOSYNTHESIS (1) Calculate the quantum yield of oxygen evolution. Hint: 2H20 are consumed for each oxygen evolved. (2) What enzyme catalyzes the Cal
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - January 28 MEASURING PHOTOSYNTHESIS (1) What are three techniques to measure primary production in the ocean? What are the advantages and disadvantages of each? (2) Diagram a typical prim
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - January 30 REMOTE SENSING (1) The CZCS sensor, which was in operation in the early 1980s, lead to great advances in the understanding of the distribution and dynamics of phytoplankton bio
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - February 2 NITROGEN CYCLE (1) Nitrogen fixation is an extremely energy intensive process. How many NADPH and ATP are required to reduce N2 to R-NH2? Which organisms are capable of this pr
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - February 4 SECONDARY PRODUCTION (1) What are the two major types (functional groups) of zooplankton. (2) What are some defining characteristics of zooplankton? How does the environment he
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - February 16 SUB-TROPICAL GYRE CIRCULATION / GULF STREAM (1) Name and locate the five major sub-tropical gyres on a world map. What are the defining characteristics of these sub-tropical g
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - February 18 GYRE CIRCULATION (1) At what scales do Langmuir cells operate? What is their significance to biological processes? Do these features 'break' through the thermocline? What caus
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - February 23 SEAWEEDS (1) List the important characteristics of Sargassum, the pelagic seaweed found in the Sargasso Sea. (2) Compare and contrast neritic seaweeds (ex. Marcocystis) with p
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - February 25 COASTAL UPWELLING (1) Locate the five major coastal upwelling regions on a world map. What features do four of these regions have in common? What makes the fifth upwelling reg
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - February 27 EQUATORIAL OCEANS (1) Compare and contrast sediments near equatorial upwelling regions for normal and El Nino years in terms of organic carbon, silicon , carbonate , and phyto
Duke - BIO - 114
BIO114L Biological Oceanography Spring 1998 Review Questions - March 2 HIGH LATITUDE OCEANS (1) Detail the physical, chemical and biological properties of high latitude oceans that make them unique including: light, nutrient concentrations (macro and
Mt. Holyoke - BSOL - 691
-10.66121936-10.61541898-10.56951853-10.52371868-10.47781927-10.43201962-10.38611926-10.34031877-10.29441888-10.24851901-10.20271912-10.15681874-10.11101863-10.06511864-10.01931856-9.97341863-9.92761864-9.88171862
Mt. Holyoke - ASOL - 880
-11.21151828-11.16561837-11.11981864-11.07391881-11.02811892-10.98221870-10.93641846-10.89051886-10.84471917-10.79881898-10.75301881-10.70711866-10.66121877-10.61541896-10.56951872-10.52371828-10.47781834-10.4320185