Wrap-Up
Answers to Self Review Exercises
15.1 |
a) Enter, Exit. b) timeslice or quantum. c) garbage collector. d) waiting, sleeping, suspended, blocked for input/output. e) Stopped. f) Lowest, BelowNormal, Normal, AboveNormal, Highest. g) Sleep. h) Pulse. i) lock. j) synchronize. |
15.2 |
a) True. b) True. c) False. The code that a thread executes is defined in the method specified by the thread's ThreadStart delegate. d) False. A thread may be in the WaitSleepJoin state for several reasons. Calling Pulse moves a thread from the WaitSleepJoin state to the Running state only if the thread entered the WaitSleepJoin state as the result of a call to Monitor method Wait. e) true. f) False. A thread is blocked by the operating system and returns to the Running state when the operating system determines that the thread can continue executing (e.g., when an I/O request completes or when a lock the thread attempted to acquire becomes available). g) False. Class Monitor methods can be called only if the thread performing the call currently owns the lock on the object each method receives as an argument. h) False. A lock block implicitly relinquishes the lock when the thread completes execution of the lock block. i) True. |
Strings, Characters and Regular Expressions
|