10 Pages

Spring 2000

Course: CS 252, Fall 2011
School: Purdue
Rating:
 
 
 
 
 

Word Count: 1126

Document Preview

2000 Final Spring Exam Name: Part 1. Answer True/False (T/F) (1 point each) ____1. The threads in a process share the same stack. ____2. The page-table register is part of the CPU. ____3. During starvation, threads will never be able to proceed. ____4. In segment-swap entire processes are swapped in and out from disk. ____5. Multi-level page tables save more space that single-level page tables. ____6. The...

Register Now

Unformatted Document Excerpt

Coursehero >> Indiana >> Purdue >> CS 252

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.
2000 Final Spring Exam Name: Part 1. Answer True/False (T/F) (1 point each) ____1. The threads in a process share the same stack. ____2. The page-table register is part of the CPU. ____3. During starvation, threads will never be able to proceed. ____4. In segment-swap entire processes are swapped in and out from disk. ____5. Multi-level page tables save more space that single-level page tables. ____6. The page-table register is updated every time there is a context switch from one thread to another. ____7. Page sizes are always a power of two. ____8. In demand paging a virtual address is divided into page number and page offset. ____9. There is one page table for each thread in a process. ____10. A physical page that is replaced is always written back to the backing store. ____11. Having multiple threads increases the reliability of a program compared to having multiple processes. ____12. ELF is an executable format used on Windows. ____13. truss is a UNIX command to show the number of users in the system. ____14. The text section of a program is memory mapped readable and executable. ____15. System calls and interrupts run in user mode. ____16. Most of the processes in a computer are in ready state. ____17. The first step in an interrupt rpoutine is to save the registers of the processes. ____18. The last step in an interrupt routine is to retry the offending instruction. ____19. There is at most one running process in the computer. ____20. Most of the CPU time is spent in user mode. ____21. A program in user mode is able to call functions and modify memory. ____22. Shared libraries run in user mode. ____23. A small time quantum will cause a program to take more time. ____24. The arguments of a system call are checked in user space. ____25. In preemptive scheduling a process takes higher priority until completion. ____26. A program that runs with preemptive scheduling runs faster than one in nonpreemptive scheduling. ____27. Most of the processes' CPU bursts are completed before the time quantum expires. ____28. There is only one page-table register in every computer. ____29. Programs that run with FCFS have a higher response time than SJF. ____30. The file descriptors of a process are closed when the process calls fork(). ____31. ____32. ____33. ____34. ____35. ____36. ____37. ____38. ____39. ____40. The write() function is a system call but printf() is not. ____41. A pipe that is used to communicate a parent and a child process could be created by the child. ____42. Threads in the same process share the same memory. ____43. A section of code that is guarded by mutex_lock()/mutex_unlock() can be executed by only one thread at a time. ____44. The process table contains a set of registers and program counters for each user and kernel level thread in a process. ____45. pthread_create() by default creates user-level threads. ____46. Disabling interrupts is faster than using spinlocks in programs that run in user space in uniprocessor systems. ____47. A mutex is equivalent to a semaphore that is initialized with a counter of 0. ____48. In the bounded buffer problem solution using semaphores, the writeBuffer() procedure waits on a semaphore that is initialized to the number of buffers available. ____49. mmap() for a shared memory section returns the same address for each caller process. ____50.cond_wait() unlocks the mutex lock that is passed as a parameter. 51. Write the steps for servicing a page-fault. (5 pts.) 52. Explain how copy-on-write works and how fork() benefits from this technique. (5 pts.) 53. The following three threads have access to five databases. Each database has its own mutex lock. Give an example of how these three threads can enter into a deadlock and explain how this can be prevented.( 5 pts.) thread1() { while (1) { mutex_lock( &mutex_db5); mutex_lock( &mutex_db2); mutex_lock( Access &mutex_db3); // db5, db2, db3 mutex_unlock( &mutex_db5); mutex_unlock( &mutex_db2); mutex_unlock( &mutex_db3); } } thread2() { while (1) { mutex_lock( &mutex_db4); mutex_lock( &mutex_db1); // Access db4, db1 mutex_unlock( &mutex_db4); mutex_unlock( &mutex_db1); } } thread3() { while (1) { mutex_lock( &mutex_db1); mutex_lock( &mutex_db2); mutex_lock( &mutex_db5); // Access db1, db2, db5 mutex_unlock( &mutex_db1); mutex_unlock( &mutex_db2); mutex_unlock( &mutex_db5); } } How this deadlock can be prevented? 54. Assume the following 2-level page table. Translate the VM address 0x00C02E4B to its corresponding physical address. Assume a page size of 4KB and that the first 10 bits of the VM address index the level 1 page table, the next 10 bits index the second level and the bits left are the page offset, similar to what was discussed in class. Assume a 32-bit word size. The third column in the level 2 page tables are physical page addresses.(5 pts) VM Address 0x00C02E4B is _______________ in Physical Memory Level 1 0 0x38000 1 0x36000 2 0x32000 3 0x40000 Level 2 At 0x38000 0 0x42000 1 0x50000 2 0x70000 Level 2 At 0x32000 0 0x56000 1 0x58000 2 0x72000 Level 2 At 0x36000 0 0x5a000 1 0x5c000 2 0x62000 Level 2 At 0x40000 0 0x89000 1 0x82000 2 0x86000 55. Assume that a computer has only three physical pages. The following diagrams show two sequences of referenced pages. Write down in the empty slots the pages that are loaded in physical memory at each page reference. Also, also write down the number of hits and misses. Use the LRU page replacing policy in both cases. Don't forget to answer the questions that are there at the end of the diagram.(5 pts) Page Referenced: Phys Page 1 Phys Page 2 Phys Page 3 1 2 3 4 1 2 3 4 1 2 3 3 2 1 1 2 # of hits = # of misses = Page Referenced Phys Page 1 Phys Page 2 Phys Page 3 # of hits = # of misses = What can you learn from these two diagrams? Why demand paging works in most computer systems? 56. Write the code for the insert() and lookup(). insert() inserts the integer i to the head of the list, lookup() returns 1 if i exists in the list or 0 otherwise. Add the necessary code to make the code thread safe. (5 pts) struct ListEntry { int _value; struct ListEntry * _next; }; class List { ListEntry * _head; // Other fields go here public: List(); void insert( int i ); int lookup( int i ); }; List::List() { } void List::insert( int i ) { } int List::lookup( int i ) { } 57. Write the code for RPCClient::call() from project 2. Try to be as precise as possible. (5 pts.) int RPCClient::call( char * rpcName, RPCArgument argument, RPCResult result ) { } 58. Complete the class ReadWriteLock that implements read/write locks. Add the fields that are necessary. IMPORTANT: Use semaphores.(5 pts.) class ReadWriteLock { /* Add other fields here */ public: ReadWriteLock(); readLock(); writeLock(); readUnlock(); writeUnlock(); }; ReadWriteLock::ReadWriteLock() { } ReadWriteLock::readLock() { } ReadWriteLock::writeLock() { } ReadWriteLock::readUnlock() { } ReadWriteLock::writeUnlock() { } 59.Complete the following procedures. sendBroadcast() sends a message to N threads that will call receiveBroadcast(). sendBroadcast() will block until the N threads have called receiveBroadcast(). receiveBroadcast() will block until a thread has called sendBroadcast() and the variable theMessage has a valid value. IMPORTANT: Use condition variables instead of semaphores. (5 pts.) const int N = 5; int theMessage; void sendBroadcast( int msg ) { theMessage = msg; } int receiveBroadcast() { int tmp = theMessage; return tmp; } main() { // Initialization goes here } 60. Complete the following procedure that prints the environment variables of a process. (5 pts) void printEnvironmentVars() { }
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:

Purdue - CS - 252
Spring 2003Final ExamName: _QuestionT/F1-78.9.10.11.12.Total:MaxGrade20pts30 pts10 pts.10 pts.10pts.10pts.10pts.100pts.Part 1. Answer True/False (T/F) (1 point each)_ Most of the CPU time is spent in user mode._ a.out is an executa
Purdue - CS - 252
Spring 2004Final ExamName: _QuestionT/F1-78.9.10.11.Total:MaxGrade20pts30 pts10 pts.10 pts.15pts.15pts.100pts.Part 1. Answer True/False (T/F) (1 point each)_ Most of the time processes are in the waiting state._ ELF is an executable
Purdue - CS - 252
Spring 2005Final ExamName: _QuestionT/F1-1011.12.13.14.Total:MaxGrade10pts40 pts10 pts.10 pts.15pts.15pts.100pts.Part 1. Answer True/False (T/F) (1 point each)_ The last step in a fage fault is to retry the offending instruction._ CO
Purdue - CS - 252
Spring 2007Final ExamName: _QuestionT/F1-56-1011.12.13.14.Total:MaxGrade10 pts.20 pts.20 pts.10 pts.10 pts.15 pts.15 pts.100 pts.Part 1. Answer True/False (T/F) (1 point each)_ The page-table register is updated every time there is
Purdue - CS - 252
Spring 2009May 4, 2009Name:__Question1. True/False2. Short questions3.4.5.6.7.Maximum10 pts8.9.10.11. Page replacement12. Page tables13. Lab question14. Filesystem15. Programming questionTotalCurrent444444444126101016
Purdue - CS - 252
Synchronization Problems withMultiple ThreadsThreads share same global variables.Multiple threads can modify the same datastructures at the same timeThis can corrupt the data structures of theprogram.Even the most simple operations, likeincreasing
Purdue - CS - 252
Synchronized Class MethodAll the statements in the method become theatomic section (synchronized block) and theClass object is the lock.class class_name cfw_static synchronized type method_name1() cfw_statement blockstatic synchronized type method
Purdue - CS - 252
System CallsSystem Calls is the way user programs requestservices from the OSSystem calls use Software InterruptsExamples of system calls are:read(file, buffer, size)write(file, buffer, size)fork()open(filename, mode)execve(cmd, args);System cal
Purdue - CS - 252
TestingThe most practical way to improve thequality of a program is through testing.Tests have to run automatically if possible.Manual testing is also useful but it is costlyin human hours.Who writes tests?The programmerThe programmer has to write
Purdue - CS - 252
The Open File TableThe process table also has a list with allthe files that are openedEach open file descriptor entry contain apointer to an open file object that containsall the information about the open file.Both the Open File Table and the Open
Purdue - CS - 252
The open() system callint open(filename, mode, [permissions]),It opens the file in filename using the permissionsin mode.Mode:O_RDONLY, O_WRONLY, O_RDWR, O_CREAT,O_APPEND, O_TRUNCO_CREAT If the file does not exist, the file iscreated.Use the permi
Purdue - CS - 252
The UNIX File SystemUNIX File SystemUNIX has a hierarchical File SystemImportant directories/ - Root Directory/etc OS Configuration files/etc/passwd User information/etc/groups Group information/etc/inetd.conf Configuration of Internet(deamons)S
Purdue - CS - 252
The UNIX Operating SystemWhat is an Operating SystemAn Operating System (OS) is a program that sitsin between the hardware and the user programs.It provides:Multitasking - Multiple processes running in the samecomputerMultiuser - Multiple users usi
Purdue - CS - 252
Threads and ForkThe behavior of fork() changesdepending on the flavor of threads youuse.When fork() is called, threads createdwith pthread_create() are not duplicatedexcept if it is the thread calling fork().In Solaris threads created withthr_crea
Purdue - CS - 252
Threads and ThreadSynchronizationIntroduction to ThreadsA thread is a path executionBy default, a C/C+ program has one threadcalled "main thread" that starts the main()function.main()-printf( "hello\n" );-Introduction to ThreadsYou can create m
Purdue - CS - 252
Types of Server ConcurrencyIterative ServerFork Process After RequestCreate New Thread After RequestPool of ThreadsPool of ProcessesIterative Servervoid iterativeServer( int masterSocket) cfw_while (1) cfw_int slaveSocket =accept(masterSocket,&s
Purdue - CS - 252
User and System Time in MTprogramsCommand time givesSystem Time = Time spent in Kernel modeUser Time = Time spent in user modeReal Time = wall clock time.In a single processor machineUser time + system time < Real timeWhy? Overhead of other progra
Purdue - CS - 252
User Mode, Kernel Mode,Iterrupts and System CallsComputer Architecture ReviewMost modern computers use the VonNewman Architecture where bothprograms and data are stored in RAM.A computer has an address bus and adata bus that are used to transfer da
Purdue - CS - 252
Using a DebuggerWhat is GDBGDB is a debugger that helps you debugyour program.The time you spend now learning gdb willsave you days of debugging time.A debugger will make a good programmera better programmer.Compiling a program for gdbYou need to
Purdue - CS - 252
Using an IDE for DevelopmentUnix System Programmingand The Shell ProjectUNIX OrganizationUNIX has multiple componentsScheduler Schedules processesFile System Provides storageVirtual Memory - Allows each process to haveits own address spaceNetwork
Purdue - CS - 252
Virtual Machines (VM)A VM is a virtual machine running in aphysical computer.More than one VM can run simultaneously inthe same machine.VMs work well because machines are nowtoo fast and underused.It allows to snapshot in a file of an OStogether w
Purdue - CS - 252
Wildcards and Hidden FilesIn UNIX invisible files start with . like .login,.bashrc etc.In these files that start with ., the . should notbe matched with a wildcard.For example echo * will not display . and .To do this, you will add a filename that s
Miami University - COM - 354*
Ch 3: Politics Influence on MediaRegulationsBroadcast liscenseHow long advertisments areDay time/prime timeDistributionProductionLabor lawsFin-syn (1970-1993)Regulted ownership issuesNetworks that distributed TV werent allowed to produce alsoGo
Miami University - COM - 339
Ch 3: Four Perspectives on Organizations & CommunicationTheory can be anything from simple ideas to formal systems of hypotheses that aim toexplain, predict, and controlHistorical: product of time in which it emerged, reflecting the cultureMetaphotica
Miami University - COM - 437*
Propaganda TechniquesWord gamesName-callingsneaky Japscowardsbreeders/homosderogatory slanghatersbaby killersLabelingLabeling people, groups, institutions, in a negative mannerAxis of EvilRight wing (Republican) or left wing (Democrat)Sociali
Miami University - FIN - 301
Chapter6InterestRates15:35Nominal(QuotedorStatedInterestRates)INomthecontracted/statedrate;theratethatcreditcardcompanies,studentloan officers,autodealerstellyoutheyarechargingonloansnotthetrueratethatrequires monthlypaymentsandotherquarterlypayments
University of Florida - ANT - 2410
19:058/24/11CulturalAnthro:Lecture1WhatisAnthropology?HowdoAnthropologistsdowhattheydo?HowdoesAnthropologycomparetootherdisciplines?MakingSenseofBeingHumanWheredowecomefrom?Whyarewesoradicallydifferentfromsomeanimalsandsosurprisinglysimilarto oth
University of Florida - FOS 2001 - 2001
Mans FoodLesson 1:Objectives:Examine the leading causes of illness and death in the United States.Explore how habits affect health.Review the quantitative aspect of nutrition.Discover nutritional status terminology and food labelingrecommendations.
University of Florida - FOS 2001 - 2001
Mans Food Module 2Lesson 6Water TerminologyIntracellular Fluid Compartment- fluid located inside your cellsExtracellular Fluid Compartment- fluid located outside your cellsInterstitial Fluid- fluid located between your cellsElectrolytes- Charged ion
University of Florida - FOS 2001 - 2001
Mans Food Module 3- The micronutrientsLesson 10- VitaminsWhat are Vitamins?Tasteless organic compounds. Non-caloric. Body cannot make themso we get them from our diet Called micronutrients because they perform their functions in verysmall amounts 1
University of Florida - LIN 2000 - 2000
1. Exposure Problem- Contributes to language death. If one is not exposed to alanguage they will not absorb it.Reasons of Language Death: Death of all speakers, changes in ecology oflanguage, culture contact and clash, economic influence. Languages can
University of Florida - LIN 2000 - 2000
Key TermsThe quiz includes material from in-class lecture, R&H textbook readings: 52, 3, 8, 56,41, 55, 18, 16; the Aitcheson course pack reading; and the supplemental audiointerview on linguistic relativity and the basic phonetics lesson (supplemental
University of Florida - LIN 2000 - 2000
Term 4 (Quiz #3)Key Terms1. *Influences (British, African, French, Yiddish, etc.) on and examples of variousAmerican dialects that were studied- British: English, Also contributed to SouthernDialect due to Southern Children going to boarding school in
Miami University - MKT - 291
NIKEnergySamantha Zid & Yang YangMKT 291 Section MAThursdays 7:15-91It seems like Nike cant do anything wrong in this day and age. When looking atsporting products its impossible not to figure Nike into the mix. The company hasendorsed the best of
Miami University - MKT - 291
Nikes next big move into thesporting worldNIKEnergyNikes Next Big Thing Nike= Gold Majorsporting good company Everybodyneeds to be hydrated Nike is stepping up to the plate NIKEnergyis THE next big thingCompany Background "Tobring inspirati
Miami University - MKT - 291
IMPORTANT COPYRIGHT NOTICEThe material in each Study.Net TEXTPAK is produced for the sole use of a unique,authorized student user. All content in this Study.Net TEXTPAK corresponds to materialassociated with a specific identified Study.Net course at a
Miami University - MKT - 291
Samantha ZidMKT 291, Ms. Cynthia Walsh11/4/2010Case AnalysisTwitter, Tweeting, TweetsIts hard to imagine a world without google, Facebook, and Twitter. Today we arewired so that we can be in constant communication with anyone we want to be across th
Miami University - MGT - 415
"When all think alike, then no one is thinking." Walter LippmanIntroductionThroughout the fall semester of my senior year at Miami University I havecontinuously been encouraged to think outside of the regular parameters of a typicaleducation frame of
Miami University - MGT - 415
India:HinduismAnaZ,ElleR,BobbyF,TimelinenIndusValleyCivilization(2500BC1500BC)nReligionoftheVedas(1500BCto500BC)nClassicalHinduism(500BC800CE)nMedievalHinduism(800CEto1900CE)nHinduismintheModernWorld(1900CEToday)OverviewnMultiplicityofGods,
Miami University - MGT - 415
"While strategy and tactics change all the time, the fundamentals of leadership do not.Leadership is a matter of how to be, not how to do." (Leader-to-Leader Institute, 2004, p. 25).MGT415: LEADERSHIP & LEARNINGDr. David Cowan 3067 FSB 529-3689 Office
Miami University - MGT - 415
PART 1Medina: structure and employment of attentionWithout attention, a leader cannot lead. The firststep that must be taken to gain attention is there must be an emotional catch; leaders have to draw theiraudience in to be effective. One must also es
Miami University - MGT - 415
Leader-to-leader Institute: beyond doing & knowing to being There are threecomponents to being a leader and can be summer up in in three simple words: be, know,and do. Leaders are people who are honest, competent, forward-looking, and inspiring.Interpe
Miami University - MGT - 415
Chrissy Berdelle, Ana Zawacki, & Samantha ZidMGT 415, Dr. CowanFall 2011TORY BURCH1. Backgrounda. Forbes video: clip about Tory Burchs fast growth and success in the retailindustryb. Tory Burch was born in Valley Forge, PA and attended school at th
Miami University - MGT - 415
Tory BurchThere are no rules aboutwhat you can and cant doanymore. Its aboutBackgroundhttp:/video.forbes.com/fvn/forbeswoman/tory-burchfoundationTory Burch was born in Valley Forge, PA and attendedschool at the University of PennsylvaniaMoved to N
Miami University - PSY - 410f
Samantha ZidPSY 410F, Dr. PalladinoSpring 2012Perspectives on humor: Disabilities and Humor1. Kathy Buckley: Kathy was my favorite comedian we watched in class. I am notthe biggest fan of stand up comedy and whenever she was on she had me laughingun
Miami University - PSY - 410f
Samantha ZidPSY 410F, Dr. PalladinoSpring Semester 2012The Funnies of my Weekend1. On Saturday morning I woke up to loud noises. Some of our guy friends came overdressed up in weird outfits (one in a clown suit) and woke us up at 9:30am byscreaming
Miami University - PSY - 410f
Samantha ZidPSY 410F1/15/20126 Examples that humor is Still Important to Mankind1. Rebecca Black: About 6 months ago a video hit youtube that made RebeccaBlack internationally known. The video was emailed, facebooked, and tweetedaround the world as
Miami University - PSY - 410f
Samantha ZidPSY 410F, Dr. Palladino1/10/2012No Humor, No FunWhen we first got the assignment to write about someone who doesnt have asense of humor it was hard for me to think of anyone. I like to think that the people Isurround myself with all have
Miami University - PSY - 410f
16:47YouknowyourefromEvansvilleYourfavoritebeerissteerlingYoustilllivethereYouknowhowtoavoidtheLloydYouhaveeatenpigbrainandknucklesandwichesYoureoverwhelmedbyRobertsstadiumFamilyreunionisduringthefallfestivalYouknowYourhousehasbeenrockedbymorecry
Miami University - BWS - 151
BWS 151: Introduction to Black World StudiesProf. Tammy L. BrownFINAL EXAM ESSAYDUE on Thursday, December 16, 2010 by 11:59PM via Turnitin on BlackboardPlease answer the following essay question. You should fully answer each part of the question inth
Miami University - BWS - 151
Samantha ZidBWS 151, Dr. BrownFinal Exam EssayTuesday, December 14, 2010Cultural BackgroundsDiversity within blackness has come to shape cultures around the world. Thedifferences in backgrounds, cultures and identities of displaced Africans around t
Miami University - BWS - 151
United States Civil Rights MovementJames Farmer of CORE (Congress of Racial Equality)ON THE FREEDOM RIDESI had not dreamed that in a few short weeks a new kind of civil war would rock the nationa war not withoutviolence, but with violence on only one
Miami University - COM - 135
11/8Culture is tied to power and privilegeHistory v. Histories: hidden/lost (losers/were persecuted and stories werent recounted)-Absent: native American groups (languages are dying off)-Hidden: recorded, hidden by dominant society threat-Free Inform
Miami University - COM - 135
How do family relationships, friendships, and romantic relationships affect Organizational Culture? Do theyhelp or harm it?I think that personal relationships are harmful to Organizational Culture. There is no wayto be impartial to those who you know p
Miami University - COM - 135
The secret society of Skulls and Bones dates back to 1832 when a group of menfrom the Phi Beta Kappa fraternity created it to promote a more elite feeling. The grouphas gained wide popularity and national attention but continues to guard its secrets and
Miami University - COM - 135
Introduction to Speech CommunicationUnit 3: Communication in ContextsExam 3 Review Sheet: Chapters 8, 10-12Chapter 10: Communication in Personal Relationships How are relationships of circumstance and relationships of choice different? Circumstance:
Miami University - COM - 135
Introduction to Speech CommunicationUnit 3: Communication in ContextsExam 3 Review Sheet: Part 2Strategic Communication Article, Persuasion Lecture and Chapter 15Strategic Communication (Public Relations) What is strategic communication? A communica
Miami University - COM - 143
Chapter 7: 1, 9, 11-14, 161. How did film go from the novelty stage to the mass medium stage? Thomas Edison developed new technology that enabled films to be seenon big screens Narrative films: movies that tell stories moved films to mass mediumstage
Miami University - COM - 143
1Samantha ZidCom 143, Dr. BeckerMeredith TAdvertisement Analysis10/25/10The Dodge Ram has Supermodels in its BedHow do you get six swimsuit models into your bed? That is a question that every guywho is reading Sports Illustrateds February 2010 swi
Miami University - COM - 143
Blockbusters and Indie FilmsNovember 11, 2010I. The Industry Responds to the CrisisA. DownsizingB. Competing with Television1. Emphasizing Spectacle (Color, 3-D, CinemaScope, Stereo)2. Drive-insC. The Rise of Art House Theaters (Ingmar Bergman, Ken
Miami University - COM - 143
Copyright Control Vs. Free CultureDecember 7, 2010I. Government Control of MediaA. Standard models1. Authoritarian model: those in government create a system of control and censorship2. State model (Pravda): if your going to print media you must get