Multithread
3 sets of local variables
3 stack pointers
3 %eax and other registers
3 schedulable RAM mutators
Potential Solution:
1 Process per Player: share object via syscalls, expensive to make game object
1 Process per Game Object: expensive to communicate
1 Thread per Player: same memory space, just load and restore registers
Benifits:
share data
UI responsiveness, code separation
Multiprocessing speedup
Kinds of Threads:
User-space threads (N:1): not actually thread
yeild() by cooperative schedulingKernel-space threads
Many-to-many threads: combination of above two methods
Asynchronous cancelation: NEVER DO THIS
behavior:
cannot garbage collect (free)
stop in the middle of updating shared resource will corrupt invariants of data structures
Deferred cancelation: thread B checks if it should be canceled at certain points
setuid()When a program is executed, it can run and switch between two identities:
invoker's identity (user who runs the program)
program's identity (owner of the program file)
During name->file, file->privilege mapping, race condition can happen allowing attacker to execute program with different privilege.
Table of Content