Fall 2011 COMP 3511 Homework Assignment #1 Solution
Handout Date: Sept. 22, 2011 Due Date: Oct. 6, 2011
Name: ______________ ID: ___________________ E-Mail: _____________ COMP 3511 L __ Please read the following instructions carefully before answering the questions: You should finish the homework assignment individually. There are a total of 4 questions. When you write your answers, please try to be precise and concise. Fill in your name, student ID, email and Section number at the top of each page. Submissions without this information will be discarded. Please fill in your answers in the space provided, or you can type your answers in a Word file. Homework Collection: the hardcopy is required and the homework is collected at…show more content… Briefly justify your answer with an example.
Answer: Yes, for instance, a process in ready state must be placed on the ready queue. 4) (5 points) Why can not a process switch from waiting state to running state directly?
Answer: The CPU could be busy, it must go through ready state waiting to be scheduled to run 5) (5 points) with only one thread is referred as a heavy-weight process, why is there no concurrency within the execution of such a process?
Answer: Since there is only one “thread” of execution and instructions can only be executed sequentially. 4. (32 points) Thread 1) (8 points) What are the two components of program states that are shared by all threads within a process? What are the two components that are dedicated to each thread?
Answer: The threads of a multithreaded process share heap memory and global variables. Each thread has its separate set of register values and a separate stack. 2) (4 points) A multi-thread process and multiple processes can both provide concurrency, what is the major benefit of using a multi-thread process?
Answer: Threads within a single process shares code and data, the context switch between threads is much simpler 3) (8 points) What resources are used when a thread is created? How do they differ from those used when a process is created?
Answer: Creating either a user or kernel thread involves allocating a small data structure to hold a register set, stack, and priority. (4 points) Because a thread is