jagomart
digital resources
picture1_2016 02 16b Pthreads


 142x       Filetype PDF       File size 0.30 MB       Source: user.it.uu.se


File: 2016 02 16b Pthreads
uppsalauniversity threadprogrammingwithposixthreads pthreads karl ljungkvist uppsalauniversity whatarethreads denition independentstreamsofinstructions within a single program whichcanbescheduledindependentlyby the os in practice athreadisaprocedure functionrunning independently from the main program awayofutilizing multiple cores lightweight process ...

icon picture PDF Filetype PDF | Posted on 03 Feb 2023 | 2 years ago
Partial capture of text on file.
                UppsalaUniversity
     ThreadprogrammingwithPOSIXThreads
                  (Pthreads)
                  Karl Ljungkvist
                                UppsalaUniversity
  Whatarethreads?
      Definition:
        ◮ Independentstreamsofinstructions within a single
           program,whichcanbescheduledindependentlyby
           the OS
      In practice:
        ◮ Athreadisaprocedure/functionrunning
           independently from the main program.
        ◮ Awayofutilizing multiple cores.
      Lightweight process:
        ◮ Only duplicates a necessary minimal
        ◮ Mostresources are shared within the process
        ◮ Less overhead
  Karl Ljungkvist | karl.ljungkvist@it.uu.se                          | 2/45
                                UppsalaUniversity
  Processes vs Threads
    Processes:                         Threads:
      ◮ Multiple instances of the        ◮ Single program with
         sameprogram,which                 parallel internal threads
         cancommunicateby                  sharing resources
         messagepassing                    (memory,openfiles,etc)
            Core 0 a.out                               a.out
                                              Core 0    t0
            Core 1 a.out                      Core 1    t1
            Core 2 a.out                      Core 2    t2
            Core 3 a.out                      Core 3    t3
  Karl Ljungkvist | karl.ljungkvist@it.uu.se                          | 3/45
                                        UppsalaUniversity
   Sharedresources
     Athreadcontainsprivate                      In addition, a Unix process
        ◮ Programcounter                         also has
        ◮ Registers and stack pointer               ◮ Process, process group, user, and
        ◮ Schedulingproperties (i.e. policy            groupIDs
           andpriority)                             ◮ Environment
        ◮ Setofpendingandblocked                    ◮ Workingdirectory
           signals                                  ◮ Programinstructions
                                                    ◮ StackandHeap
                                                    ◮ File descriptors
                                                    ◮ Signal actions
                                                    ◮ Sharedlibraries
                                                    ◮ Inter-process communication
        Lightweight process                            tools
          ◮ Process to thread creation overhead ∼ 10:1
   Karl Ljungkvist | karl.ljungkvist@it.uu.se                                            | 4/45
The words contained in this file might help you see if this file matches what you are looking for:

...Uppsalauniversity threadprogrammingwithposixthreads pthreads karl ljungkvist whatarethreads denition independentstreamsofinstructions within a single program whichcanbescheduledindependentlyby the os in practice athreadisaprocedure functionrunning independently from main awayofutilizing multiple cores lightweight process only duplicates necessary minimal mostresources are shared less overhead it uu se processes vs threads instances of with sameprogram which parallel internal cancommunicateby sharing resources messagepassing memory openles etc core out t sharedresources athreadcontainsprivate addition unix programcounter also has registers and stack pointer group user schedulingproperties i e policy groupids andpriority environment setofpendingandblocked workingdirectory signals programinstructions stackandheap file descriptors signal actions sharedlibraries inter communication tools to thread creation...

no reviews yet
Please Login to review.