UCF School of Computer Science



CS Division – EECS DepartmentUniversity of Central FloridaCGS 3763 – Operating System ConceptsSpring 2013 – dcmHomework 4 (100 points)Due Wednesday, March 13 2013 - 5 PMA homework should be written in Word or Latex and should be Emailed to the TAEdward Aymerich, Email: edward.aymerich@knights.ucf.edu Subject of the Email: First.Last student name - HW4Problem 4.1 (10pts)What are two differences between user-level and kernel-level threads?1. Kernel-level threads are supported and managed directly by the kernel, whereas user-level threads are managed without kernel support.2. The creation of user-level threads is usually faster than the creation of kernel-level threads.Problem 4.2(5pts)Describe the actions taken by a kernel to context-switch between kernel level threads.The kernel saves the state of the current thread, and then restores the state of the new thread being scheduled.Problem 4.3 (10pts)What resources are used when a thread is created? How do they differ from those used when a process is created?A new context (CPU registers) and stack must be created for the new thread. When a new process is created, a full PCB must be created, which has a lot more information (memory allocated, list of open files, accounting information, etc.), and also memory must be allocated for the code and data of the new process. Problem 4.4 (5pts)Which of the following program components are shared across threads in a multithreaded process?Register valuesHeap memoryGlobal variablesStack memory Heap memory and Global variables are shared across threads.Problem 4.5 (15pts)Consider a multiprocessor system and a multithreaded program written using the many-to-many threading model. Let the number of user-level threads N be larger than P the number of processors. Call K the number of kernel threads allocated to the program. Discuss the performance implications of the following scenarios:K < PK = PP < K < N1. K<PThe process won't use all the processors in the system. All the work of the process will be done by a few processors, taking more time for the process to finish.2. K=PThe process will utilize all the processors in the system, therefore the work will finish as soon as possible. But if a thread is blocked by a system call, then a processor is not utilized while the thread waits, lowering the system usage.3. P < K < NAll the processors in the system will be used by the process. The OS will have to schedule the K threads over the P processors, with a little overhead for the context switching. However, if a thread running in some processor gets blocked by a system call, the scheduler can schedule another ready thread in that processor, maximizing system utilization.Problem 4.6 (15pts)Define the concepts of CPU-bound and I/0-bound process. Why is it important for a scheduler to distinguish the two.A CPU-bound process is a process that spends most of his time executing instructions.An I/O-bound process is one which spends most of his time waiting for I/O operations to complete. It is important for a scheduler to distinguish the two because this allows the scheduler to keep a balanced system. If the scheduler only executes processes that are I/O-bound, then the CPU is underutilized. On the contrary, if the scheduler only executes processes that are CPU-bound then a high CPU utilization is achieved, but other system resources (such as the hard drive or network interface) may be underused. A good balance of CPU-bound and I/O-bound processes keeps the overall system as busy as possible.Problem 4.7 (15pts)Discuss how the following pairs of scheduling criteria conflict in certain settings.CPU utilization and response time.A system can have a better response time using a scheduling policy like Round Robin, but the more frequent context switching could lower CPU utilization.Average turnaround time and maximum waiting time.The average turnaround time can be minimized using a Shortest Job First scheduling policy, but this could increase the maximum waiting time, because bigger jobs are always pushed behind smaller jobs.I/O device utilization and CPU utilization.To achieve maximum CPU utilization the scheduler must choose long running CPU-bound processes, but doing so will lower I/O device utilization. To maximize I/O device utilization, the scheduler must choose I/O-bound processes, which spend most of their time waiting for the devices to reply, so the CPU utilization is lowered.Problem 4.8 (6+6+6+2=20pts)a.FCFSP1P2P3P4P501011131419SJFP2P4P3P5P10124919Non preemptive PriorityP2P5P1P3P4016161819RR (quantum=1)P1P2P3P4P5P1P3P5P1P5P1P5P1P5P1P1P1P1P1012345678910111213141516171819b.Turnaround time for each process:FCFSSJFPriorityRRP110191619P211112P3134187P4142194P5199614c.Waiting time for each process:FCFSSJFPriorityRRP10969P210001P3112165P4131183P514419Sum48164127Average9.63.28.25.4d.SJF results in the minimum average waiting time (3.2).Problem 4.9 (5pts)Which one of the following scheduling algorithms could result in starvation?FCFSSJFRRPrioritySJF and Priority. There could be starvation in SJF if shorter processes keep arriving, preventing older (bigger) processes from being executed. Similarly, there could be starvation in Priority if processes with high priority keep arriving, preventing older (with less priority) processes from being scheduled. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download