代写EECS 678 – Fall 2019代写留学生Matlab语言程序

EECS 678 Fall 2019

1 Chapter 6

1.  What is a critical section?  What are the three conditions to be ensured by any solution to the critical section problem?

2.  The following code only ensures two of the three conditions for solving the critical section problem.  What condition does it not support?  Modify the code to provide support for all three conditions to address the critical section problem.

int mutex  =  0;

do  {

while(TestAndSet(&mutex));

//  Critical  section

mutex  =  0;

//  Remainder  section

}while  (TRUE);

3.  Provide the pseudo code definitions of the following hardware atomic instructions:

(a) TestAndSet and (b) Swap.

4.  A general synchronization solution using locks looks as follows:

int mutex;

init_lock(&mutex);

do  {

lock(&mutex);

//  critical  section

unlock(&mutex);

//  remainder  section

}while(TRUE);

Provide the definitions of init lock, lock, and unlock when using (a) TestAndSet, (b) Swap and (c) Semaphores.

5.  Define semaphores (simple semaphores and semaphores with no busy waiting).

6.  What is priority inversion? How does the priority inheritance protocol address this issue?

7.  Explain why spinlocks are not appropriate for uniprocessor systems, yet may be suitable for multiprocessor systems.

8.  Show that if the wait and signal semaphore operations are not executed atomically, then mutual exclusion may be violated.

9.  List the drawbacks of Semaphores. How can Monitors overcome the drawbacks?

10.  How do monitors ensure mutual exclusion?

11.  The code on Slide 53 shows a solution to the bounded bufer problem using monitors and condition variables.  Using illustrative figures (as demonstrated in class) show how the fol- lowing sequence of process events will be handled with  (a) Hoare and  (b) Mesa condition variable semantics.

Events:  C1 P1 C2

Here, Pn indicates ‘producer’ and Cn indicates a ‘consumer’ process.

12.  How do the semantics of the wait() and signal operations difer in semaphores and monitors?

2 Chapter 5

1.  (a) is the amount of time to execute a particular process (submission time to completion time).

(b) is the amount of time a process is waiting in the ready queue.

(c) modeling uses a pre-determined workload and defines the performance of each algo- rithm for that workload.

2.  Describe the diference between preemptive and non-preemptive scheduling.  State why strict non-preemptive  scheduling  is  unlikely to be used on  machines  supporting programs that provide interactive user services.

3.  The processes listed below( P1,  P2,  P3,  P4,  and P5) are assume to all arrive at time 0. Perform. the following analysis addressing how diferent scheduling algorithms would execute these processes, and how each would perform. as measured by diferent metrics.

•  (a) Draw 4 Gantt charts illustrating the execution of these processes using FCFS, SJF, non-preemptive priority (a smaller priority number implies a higher priority), and RR (quantum=1) scheduling

Name

Burst Time

Priority

P1

P2

P3

P4

P5

3

7

2

4

1

1

2

2

4

3

•  (b) What is the turnaround time of each process for each of the scheduling algorithms specified in part (a)?

•  (c) What is the waiting time of each process for each of the scheduling algorithms given in part (a)?

•  (d) Which of the algorithms in part  (a) results in the minimum average waiting time (over all processes)?

4.  Most round-robin schedulers use a fixed size CPU time quantum for allocating CPU time. Large quantum sizes provide certain advantages to the system, while small quantum sizes provide other advantages.   Assume that you are designing a system where throughput is more important than response time, while use of round-robin scheduling is required.  Explain whether you would use a relatively large or relatively small quantum value for such a system, and why.

5.  Five batch jobs, P1 through P5, arrive at a computer center at essentially the same time. Their burst times and priorities are defined by the table below.  0 is the best priority.  For

Name

Burst Time

Priority

P1

P2

P3

P4

P5

15

5

11

9

8

2

8

5

1

7

each of the following scheduling algorithms, determine the turnaround time for each process, and the average turnaround for all jobs.  Ignore process switching overhead.  Show how you arrived at your answers.

Except for Round Robin, assume that only one job at a time runs, until it finishes.  All jobs are completely CPU bound.

• First Come First Serve (P1 first, P6 last)

•  Shortest Job First

• Non-Preemptive Priority

•  Round Robin with a quantum of 1

6.  Devise  an  approximation  formula to  estimate the  length  of the  next  CPU  burst  for the following criteria:   (a) length of last  CPU burst and past prediction histories are equally weighted.  (b) past prediction history does not count.

What would each formula guess for each of its next CPU bursts for a sequence of real CPU burst times that appear as following:

CPU burst (ti): 4 10 10 10 2 6 10 10 6 4 4

Assume that the initial guess time is 6 time units.

7.  Why is aging used during priority scheduling algorithms?

8.  What is multi-level queue scheduling? Explain its main features.

9.  During lottery scheduling each short job is assigned 5 tickets and each long job is given 2 tickets. How much CPU will be allocated to each short and long job is the system contains:

(a) 5 short and 5 long jobs, (b) 1 short and 10 long jobs.

10.  In contention scope, all the threads in a single process are mapped to a single kernel thread.

11.  What is load balancing on multi-threaded systems? How does the OS perform. load balanc- ing?

3 Chapter 8

1.  Illustrate how to protect processes from one-another using the base and limit registers.

2.  Explain compiler time, load time, and execution time address binding. What type of binding is generally used in current OS?

3.  Discuss the diferences between logical and physical addresses and address spaces as they relate to an executing program.

4.  Explain static and dynamic loading.

5.  What is dynamic linking ?

6.  What is the need for swapping ?

7. What are the drawbacks of contiguous memory allocation ?

8. Explain, compare, and contrast the following resource allocation policies: (a) First Fit, (b) Best Fit, and (c) Worst Fit.

9. Compare and contrast internal and external fragmentation.

10. What is paging? How does it overcome the drawbacks of contiguous memory allocation ?

11. Assuming a page size of 2K and a 32-bit machine, how many bits are used for the page number, and how many are used for the ofset within the page? Give the main reason why page sizes are usually powers of two.

12. Consider a system with memory mapping done on a page basis, and using a single level page table. Assume that the necessary page table is always in memory.

(a) If amemory reference takes 100 nanoseconds, how long does a memory mapped reference take if there is no TLB within the MMU to cache recently used page addresses?

(b)Now we add an MMU which imposes an overhead of 15 nanoseconds on a hit or a miss. If we assume that 90 percent of all memory references hit in the MMU TLB, what is the Efective Memory Access time?

13. When is a simple page table structure inefective ? Explain the properties of (a) hierarchical page tables, (b) hashed page table, and (c) inverted page tables.

14. How is segmentation diferent from the paging memory model ? Illustrate the segmentation architecture.

15. Given ve memory partitions of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order), how would each of the first-fit, best-fit, and worst-fit algorithms place processes of 212 KB, 417 KB, 112 KB, and 426 KB (in order)?Which algorithm makes the most e伍cient use of memory?

16.  Assuming a 1 KB page size, what are the page numbers and ofsets for the following address references (provided as decimal numbers):  a.  2375, b.  19366, c.  30000, d.  256, e.  16385

17.  Consider a computer system with a 32-bit logical address and 4 KB page size.  The system supports up to 512 MB of physical memory.  How many entries are there in:

a. A conventional single-level page table?

b. An inverted page table?

18.  Consider the following segment table:  What  are the physical  addresses for the following

Segment

Base

Length

0

1

2

3

4

219

2300

90

1327

1952

600

14

100

580

96

logical addresses?  a.  0,430, b.  1,10, c.  2,500, d.  3,400, e. 4,112

4 Chapter 9

1.  Explain the need for Virtual Memory.  Do you know any modern OS that use virtual memory concepts?

2.  Explain demand paging.

3.  Under what circumstances do page faults occur?  Describe the actions taken by the operating system when a page fault occurs.

4.  When would the OS invoke a page replacement algorithm ?  Explain basic page replacement. Answer: On a page fault, if all physical memory frames are occupied, see slides 15-16.

5.  Assume  that  you  have  a  page-reference  string  for  a  process  with  M  frames  (initially  all empty). The page-reference string has length P; N distinct page numbers occur in it.  Answer these questions for any page replacement algorithm:

(a) What is a lower bound on the number of page faults?

(b) What is an upper bound on the number of page faults?

6.  What is the  Belady’s  anomaly?   Which page replacements sufer from it,  and which  are immune?

7.  Explain two LRU implementation algorithms (counter and stack implementation).

8.  How can victim frames optimize page fault handling ?

9.  Should there be a minimum and/or maximum limit on the number of frames allocated to each process ? Explain.

10.  Distinguish between:  (a) Equal and proportional allocation,  (b) Global and local page re-placement algorithms.

11.  What is thrashing? How may it be caused?

12.  Consider a demand-paged computer system where the degree of multi-programming is cur- rently fixed at four.  The system was recently measured to determine utilization of CPU and the paging disk.  The results are one of the following alternatives.  For each case, what is happening?  Can you increase the degree of multiprogramming to increase the CPU utiliza- tion?

(a) CPU utilization, 13 percent; disk utilization, 97 percent

(b) CPU utilization, 87 percent; disk utilization, 3 percent

(c) CPU utilization, 13 percent; disk utilization, 3 percent.

13.  What are the benefits of the slab  allocation policy over the buddy allocator. answer: Slide 45.

14.  Explain some issues in deciding the page size to use. answer: Slide 47 OR slide 23 in Chapter 8.

15.  List costs and benefits of using virtual memory.

16.  A certain computer provides its users with a virtual-memory space of 232  bytes.  The com- puter has 218  bytes  of physical memory.   The virtual memory is implemented by paging, and the page size is 4096 bytes. A user process generates the virtual address 11123456. Ex- plain how the system establishes the corresponding physical location.  Distinguish between software and hardware operations.

17.  Table 9.1 is a page table for a system with 12-bit virtual and physical addresses with 256- byte pages. The list of free page frames is D, E, F (that is, D is at the head of the list, E is second, and F is last.)

Page

Page Frame

0

1

2

3

4

5

6

7

8

9

-

2

C

A


4

3

B

0

Given the following virtual addresses, convert them to their equivalent physical addresses in hexadecimal. All numbers are given in hexadecimal.  (A dash for a page frame. indicates the page is not in memory.)  (a) 9EF, (b) 111, (c) 700, (d) 0FF

18.  What is the cause of thrashing?  How does the system detect thrashing?  Once it detects thrashing, what can the system do to eliminate this problem?

19.  Assume there is an initial  1024 KB segment where memory is allocated using the Buddy system.  Using Figure 9.27 as a guide, draw the tree illustrating how the following memory requests are allocated:  (a) request 240 bytes (b) request 120 bytes (c) request 60 bytes (d) request 130 bytes

Next, modify the tree for the following releases of memory.  Perform. coalescing whenever possible:  (a) release 240 bytes (b) release 60 bytes (c) release 120 bytes

5 Chapter 10

1.  The OS file system interface is said to provide an abstraction over reality. Explain. Answer: Slide 2.

2.  What is a raw partition? When might it be useful?

3.  What are the advantages and disadvantages of :  (a) Single-level directory, (b) Tree structured directory.

4.  How do acyclic graph directory structure overcome the limitation of tree structured directory structure ?

5.  Explain soft and hard links, as used in Unix.

6.  Explain in brief the file protection system maintained in Linux.

7.  Could you simulate a multilevel directory structure with a single-level directory structure in which arbitrary long names can be used? How? Would your answer change if the file names were limited to seven characters?

8.  Consider a file system where a file can be deleted and its disk space reclaimed while links to that file still exist. What problems may occur if a new file is created in the same storage area or with the same absolute path name? How can these problems be avoided?


热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图