Skip to main content
留学咨询

程序代写案例-17OS

By December 22, 2020No Comments

2020/10/26 下午7:17OS Fall 2020 Midterm Exam ⻚码:1/9https://docs.google.com/forms/d/e/1FAIpQLSc4HrPoeV4sYy-4oBH1a0a6ykxzryMtv2nl-t7PwukfdfZePQ/formResponse [ 1, 1 ] [ 1, M ] [ 1, X ] [ M, 1 ] [ X, 1 ] [ M , X ] [ X , M ] [ M, M ] [ X, X ] insu,cient information to answer this question OS Fall 2020 Midterm Exam Given is an operating system that only suppo!s the user-level threading model (M:1) but NOT the kernel level (1:1) . A clever programmer programmed her application using threads. When this program is run on a system with cpus, what is the combination of “[ maximum concurrency , maximum parallelism ]” (see possible answers below) this application can achieve when M is signi”cantly higher than X ? [ 4 points ] 2020/10/26 下午7:17OS Fall 2020 Midterm Exam ⻚码:2/9https://docs.google.com/forms/d/e/1FAIpQLSc4HrPoeV4sYy-4oBH1a0a6ykxzryMtv2nl-t7PwukfdfZePQ/formResponse We have talked at length in class about the di#erences between interrupts, systemcalls (traps) and exceptions. Provided are a few examples of events that trigger an entry into the OS kernel. Each row should only have one answer. A correct answer is 1pt an incorrect answer is -0.5. [ 8 points ] Interrupt Systemcall Exception Unsure User hits keyboard IO device completed a disk read Scheduler quantum expires Process issues pipe() Process issues read() on a Hle Process stores to write protected area Thread issues a division by zero: Loat x = 3.14 / 0.0 Thread dereferences a NULL ptr : int x = *((int*)NULL;; 2020/10/26 下午7:17OS Fall 2020 Midterm Exam ⻚码:3/9https://docs.google.com/forms/d/e/1FAIpQLSc4HrPoeV4sYy-4oBH1a0a6ykxzryMtv2nl-t7PwukfdfZePQ/formResponse fork() and exec() are two fundamental system calls. Identify whether the de”nition/prope!y described is true or false (must choose) or unsure/unmarked. Correct row is 1 pt, an incorrect row leads to ½ pt deduction or 0 pts for blank or “Unsure”. [ 8 points ] True False Unsure exec() uses copy-on- write semantics fork() return code identiHes whether parent or child fork() creates a whole new process fork() does nothing unless combined with exec() exec() returns only on error exec() replaces the program of the currently running process exec() creates execution unit and then forks a new process. fork() creates only a new address space 2020/10/26 下午7:17OS Fall 2020 Midterm Exam ⻚码:4/9https://docs.google.com/forms/d/e/1FAIpQLSc4HrPoeV4sYy-4oBH1a0a6ykxzryMtv2nl-t7PwukfdfZePQ/formResponse Batch Job Process Address Space Thread Task Interactive Job TCB PCB Address Space Process Stack Process Heap No saving required since registers are virtualized in the CPU Given is a multi-threading capable Operating System suppo!ing the 1:1 threading model. Which of the following entities does the CPU scheduler select for execution ? [ 2 points ] Given is a multi-threading capable Operating System suppo!ing the 1:1 threading model. During a kernel context switch (e.g. due to preemption or blocking on I/O where is the state such as registers saved ? [ 3 points ] 2020/10/26 下午7:17OS Fall 2020 Midterm Exam ⻚码:5/9https://docs.google.com/forms/d/e/1FAIpQLSc4HrPoeV4sYy-4oBH1a0a6ykxzryMtv2nl-t7PwukfdfZePQ/formResponse mutex + mutex-exclusive mutex + counting binary + non-binary bounded-buffer + binary counting + non-binary mutex + bounded-buffer There are two types of semaphores. Select the one that identi”es the correct names of those types as used in class. [ 3 points ] 2020/10/26 下午7:17OS Fall 2020 Midterm Exam ⻚码:6/9https://docs.google.com/forms/d/e/1FAIpQLSc4HrPoeV4sYy-4oBH1a0a6ykxzryMtv2nl-t7PwukfdfZePQ/formResponse struct { int value; List waiting; } struct { int value; Liststruct { int value; List consumers; } struct { int pvalue; int cvalue; List producers; List; } struct { int value, List users; } struct { int value; List users; } struct { int value; List producers; } struct { int value; List producers; } struct { int pvalue; int cvalue; List producers; List; } struct { int value; List consumers; } A semaphore is implemented using multiple members. Assume a multi-threading capable operating system. Select the most correct de”nition, paying a%ention to the functionality implied by the name of the struct members [ 4 points ] 2020/10/26 下午7:17OS Fall 2020 Midterm Exam ⻚码:7/9https://docs.google.com/forms/d/e/1FAIpQLSc4HrPoeV4sYy-4oBH1a0a6ykxzryMtv2nl-t7PwukfdfZePQ/formResponse unsupervised vs supervised user vs kernel fork vs exec exec vs fork unsupervised vs priviliged problem vs no-problem priviliged vs unpriviliged kernel vs user A CPU typically operates in two di#erent modes, namely at the application level and at the operating system level. What are these two modes most commonly called. Pick the most appropriate pair where the le& side identi”es the application and the right side identi”es the operating system mode. [ 2 points ] Given the schedulers implemented in lab2 (FCFS, LCFS, SRTF, RR, PRIO, PREPRIO), which scheduler is the best for the stated system objective in each row [ 8 points ] FCFS LCFS SRTF RR PRIO PREPRIO same fairness but preempt after a speciHed quantum always make sure the highest 2020/10/26 下午7:17OS Fall 2020 Midterm Exam ⻚码:8/9https://docs.google.com/forms/d/e/1FAIpQLSc4HrPoeV4sYy-4oBH1a0a6ykxzryMtv2nl-t7PwukfdfZePQ/formResponse priority job runs System/Job throughput with earlier ready jobs Hrst system/job throughput with recent ready jobs Hrst priorities of processes are taken into account, but number of context switches should be small smallest average response time for io-bound processes same perceived fairness among jobs smallest average waiting time across all processes , 2020/10/26 下午7:17OS Fall 2020 Midterm Exam ⻚码:9/9https://docs.google.com/forms/d/e/1FAIpQLSc4HrPoeV4sYy-4oBH1a0a6ykxzryMtv2nl-t7PwukfdfZePQ/formResponse Synchronization and Parallelization Synchronization and Event NotiHcation Event NotiHcation and Parallelization None of the three operations (Synchronization, Parallelism or Event NotiHcation) All of the three operations (Synchronization, Parallelism or Event NotiHcation) Page 2 of 2 Never submit passwords through Google Forms. This form was created outside of your domain. Report Abuse – Terms of Service – Privacy Policy Locks, Semaphores, Conditions Variables and Monitors suppo! which of these operations? Select the most appropriate answer [ 3 points ] Back Submit Forms 欢迎咨询51作业君

admin

Author admin

More posts by admin