Wednesday, June 26, 2013

Answers of Concepts of Programming Languages Chapter 13

Review Questions
1. Instruction level, statement level, unit level,  and program level
2. SIMD : computers that have multiple processors that execute the same instruction simultaneously
3. MIMD: computers that have multiple processors that operate independently but whose operations can be synchronized
5. Unit level concurrency
6. Vector processors have groups of registers that store the operands of a vector operation in which the same instruction is executed on the whole group of operands simultaneously
8. Scheduler manages the sharing of processors among the tasks.
10. A task is in the blocked state is when the task has been running, but the execution was interrupted by one of several different events
11. Three characteristics of tasks distinguish them from subprograms are :

  • a task may be implicitly started, whereas  a subprogram must be explicitly called
  • when a program unit invokes a task, in some cases it need not wait for the task to complete its execution before continuing its own
  • when the execution of a task is completed, control may or may not return to the unit that started the execution
12. Heavyweight task is the task executed in its own address space, while lightweight task executes in the same address space.
15. Five different states of task :
  • New
  • Ready
  • Running
  • Blocked
  • Dead
16. A task descriptor is a data structure that stores all of the relevant information about the execution state of a task
17. A guard is a linguistic device that allows the guarded code to be executed only when a specified condition is true
19. Competition and cooperation synchronization
24. Concurrent Pascal, Modula, CSP/k and Mesa
30. terminate clause is used to end the execution of a task
35. The yield method is a request from the running thread to surrender the processor voluntarily

Problem Set
1. Because two or more tasks are racing to use the shared resource and the behavior of the program depends on which task arrives first
7 & 8. Comparisons between C# and Java : 
  • C#'s method can be run in its own thread. In Java, only methods named run can run in their own threads.
  • Java supports actor threads, but C# supports both actor and server threads.
  • Thread termination is also cleaner with C$
  • Synchronization in C# is more sophisticated

No comments:

Post a Comment