Hack hack hack...

An open journal-- some of it written for you, but most of it is for me.

Parallelism

Threads
 and
 processes:

A
 computer
 will
 often
 appear
 to
 be
 doing
 many
 things
 simultaneously,
 such
 as
 checking
 for
 new
 e‐mail
 messages,
 saving
 a
 Word
 document,
 and
 loading
 a 
website. Each
 program
 is
 a
 separate
 “process”.

 Each
 process
 has
 one
 or
 more
 “threads. “

If 
a 
process
 has
 several
 threads,
 they
 appear
 to
 run
 simultaneously. 
For
 example,
 an
 e‐mail
 client
 may
 have
 one
 thread
 that
 checks
 for
 new
 e‐mail
 messages
 and
 one
 thread
 for
 the
 GUI
 so
 that
 it
 can
 show
 a 
button
 being
 pressed. 
In 
fact,
 only
 one
 thread
 is 
being
 run
 at
 any
 given
 time. 
The
 processor
 switches
 between
 threads
 so
 quickly
 that
 they
 appear
 to
 be
 running
 simultaneously. Multiple
 threads
 in 
a 
single
 process
 have
 access
 to 
the
 same
 memory.

 By
 contrast,
 multiple
 processes
 have
 separate
 regions
 of
 memory
 and
 can
 only
 communicate
 by
 special
 mechanisms. 
The
 processor
 loads
 and
 saves
 a
 separate
 set
 of
 registers
 for
 each
 thread. Remember,
 each
 process
 has
 one
 or
 more
 threads,
 and
 the
 processor
 switches
 between
 threads.

Comments