Saturday, May 19, 2012

Thread Safe?


"Every function that uses files in some way. This  includes printf, scanf, getchar, and putchar (unsafe). The functions sprintf and  sscanf are not included (safe)." They (former) need mutex in a certain way to serialize these operations. 

  • Thread(or task) is an entity in multi-tasking and they can share memory (global variable) with mutex mechanism. / threads are under the same application.
  • An application (process) can launch multiple threads.
  • Process is a standalone self-contained application and it "cannot" share the global variables. (They run on the different contexts -  属性 ) They can only communicate thru IPC channel.
  • Multiple processes can run on a CPU.



No comments:

Post a Comment