threads

Cards (17)

  • Threads
    A basic unit of CPU utilization comprising of a Thread ID, Program counter (PC), Register set and Stack
  • Threads
    • Threads share with other threads belonging to the same process its code section, data section, and other operating-system resources, such as open files and signals
  • Single-threaded process

    A traditional process has a single thread of control
  • Multi-threaded process

    If a process has multiple threads of control, it can perform more than one task at a time
  • Applications using threads
    • Application that creates photo thumbnails from a collection of images
    • Web browser
    • Word processor
  • User Level Threads (ULTs)
    Threads that are created and managed by a user-level library or runtime environment, rather than by the operating system
  • Kernel threads
    Threads that are supported and managed directly by the operating system
  • User Level Threads
    • POSIX threads (pthreads)
    • Java threads
    • Python threads
    • Ruby threads
  • Kernel Threads
    • Linux kernel threads (kthread, keventd, ksoftirqd, kworker)
    • Windows kernel threads (System threads, Driver threads, System service threads)
    • macOS kernel threads (kernel_task, sysctl_thread, mach_thread)
  • Many-to-one model
    Maps many user-level threads to one kernel thread
  • One-to-one model
    Maps each user thread to a kernel thread
  • Many-to-many model
    Multiplexes many user-level threads to a smaller or equal number of kernel threads
  • Processes have their own resources while threads share the resources with the parent process
  • Processes have separate memory spaces, while threads share the memory of the process
  • Processes use IPC mechanism, while threads use shared memory and synchronization primitives
  • Processes are independent, while threads are executed in the context of the parent process
  • Processes are heavyweight, while threads are lightweight