GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Threads

Ar B Computer Science Masters Englisch

Inhalt der Mindmap

Threads

  1. Benefits

    • Responsiveness
      • User interaction can be run in different threads
    • Resource Sharing
      • Threads of same process share address space
        • Used shared variables to communicate (more efficient than message passing)
    • Economy
      • Smaller memory footprint
    • Scalability
      • Make use of parallel processing
    • Reduce progamming complexity
  2. Concurrent and parallel execution

  3. Definition

    • Thread is an execution state of a process
  4. User threads

    • Thread management done by user-level thread library
      • POSIX
      • WIN32
      • Java
  5. Threading modes

    • Kernel may not support multi-threaded processes
      • Can still implement threading in user threads
    • Threading models for mapping user threads to kernel threads
      • Many-to-one
        • Many user-threads mapped to single kernel thread
          • Useful if kernel doesn't support threads
          • Problem if one user thread calls blocking kernel function
            • Could block all other threads (whole process)
              • Solution: replace blocking calls with non-blocking calls and schedule threads in user space
                • Shift kernel work to user space
      • One-to-one
        • Each user-level threads maps to one kernel thread
          • Context switch overhead for switching between threads
            • Overhead not as big as process switching
              • Switching less data - page tables / memory shared between threads
      • Many-to-many
        • Many user threads mapped to many kernel threads
        • Two-level model
          • Can bind user thread directly to kernel thread
  6. Thread cancellation

    • Asynchronous cancellation
      • Terminates thread immediately - useful as last resort
    • Deferred cancellation
      • Target thread allowed to periodically check if it should be cancelled
        • Cleaner - thread can perform clean up (closing files)
  7. Signal handling

    • Used to notify processes that a particular event has occurred
    • Signal handler used to process signals
      • Signal generated by event
        • Signal delivered to a process
          • Signal handled by some function
      • More complex in multi-threaded processes
        • Do you act on processes or individual threads?
        • Can deliver signal to thread to which signal applies
        • Can deliver signal to every thread in the process (kill signal)
        • Can deliver signal to certain threads
        • Can assign specific thread to receive all signals for the process
  8. Thread pools

    • Waste a lot of processing by creating / destroying threads
      • Solution: Pre-create a number of threads in a pool - threads await work
        • If no threads are free then block
        • Advantages
          • Slightly faster to service new request using an existing thread (reduces overhead)
          • Allows number of threads to be bound to size of the pool - ensures some level of service
            • Control degree on concurrency
              • Guarantee throughput
            • Eliminates thrashing

Informationen

Beschreibung
Masters Computer Science (OS) Mindmap am Threads, erstellt von Ar B am 27/04/2016.
Erstellt von
Ar B
Aufrufe
1
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck