CSAPP英語學習系列:OSTEP

xing393939 發表於 2021-04-07
26 Concurrency: An Introduction
You might also notice how this ruins our beautiful address space lay-
out. Before, the stack and heap could grow independently and trouble
only arose when you ran out of room in the address space. Here, we
no longer have such a nice situation. Fortunately, this is usually OK, as
stacks do not generally have to be very large (the exception being in pro-
grams that make heavy use of recursion).

ruin
美[ˈruːɪn]
v. 毀壞;破壞

run out
美[ˈrʌn aʊt]
用完;耗盡

recursion
美[rɪˈkɜrʃn]
n. 遞迴
26.1 Why Use Threads?
Of course, in either of the cases mentioned above, you could use multi-
ple processes instead of threads. However, threads share an address space
and thus make it easy to share data, and hence are a natural choice when
constructing these types of programs. Processes are a more sound choice
for logically separate tasks where little sharing of data structures in mem-
ory is needed.

hence
美[hens]
adv. 因此

construct
美[kənˈstrʌkt]
v. 建築;繪製

separate
美[ˈsepəreɪt]
v. (使)分開,分離
26.2 An Example: Thread Creation
As you might be able to see, one way to think about thread creation
is that it is a bit like making a function call; however, instead of fifirst ex-
ecuting the function and then returning to the caller, the system instead
creates a new thread of execution for the routine that is being called, and
it runs independently of the caller, perhaps before returning from the cre-
ate, but perhaps much later. What runs next is determined by the OS
scheduler, and although the scheduler likely implements some sensible
algorithm, it is hard to know what will run at any given moment in time.

determine
美[dɪˈtɜːrmɪn]
v. 查明;測定

sensible
美[ˈsensəbl]
adj. 明智的;合理的
本作品採用《CC 協議》,轉載必須註明作者和本文連結