11/9/14

Basics of Concurrent Programming.

Concurrent work is multiple works happening at the same time.

Process is a running program.

Thread (lightweigh process, LWP) is object inside heavyweight process that has it's own control & that shares resources with other threads in the same process.

Critical section is a code section that can be accessed by only one process or thread at the same time.

critical section has uses for example in banking: we do not want data to be overwritten as it's written by other process, or read during writing.

example pseudocode:

process P;

begin
  while true do
  begin
    personal_affairs;
    begining_protocol;
    critical_section;
    ending_protocol;
  end
end;

Source: my partial education (see: [7]), my experience.

See also: Petersen's Algorithm, Classic Concurrency Problems, Petri Nets.

No comments:

Post a Comment