What is the relationship between threads and processes?
A thread is a subset of a process, of which numerous threads can be formed. Threads have advantages such as sharing the address space and global variables, while also having its own stack, program counter and alotted registers.
Operating System
- asked 9 years ago
- B Butts
2Answer
The distinction between process and thread is fairly universal to all operating systems. A process usually represents an independent execution unit with its own memory area, system resources and scheduling slot.
A thread is typically a "division" within the process - threads usually share the same memory and operating system resources, and share the time allocated to that process. For example, when you open your Browser and Microsoft Word, each is a different process, but things that happen in the background of each (like animations, refreshes or backups) can be threads.
A job is usually a long-running unit of work executed by a user. The job may be "handled" by one or more processes. It might not be interactive. For instance, instructing the machine to zip a large file or to run some processing script on a large input file would typically be a job. The naming is relatively historic - Mainframes used to process jobs. In UNIX systems, many jobs are started automatically at prescheduled times using cron, so you have the notion of 'cron jobs'.
- answered 8 years ago
- Gul Hafiz
So, a process is a single program. It has at least one thread, maybe more. Each thread takes one scheduler slot, but schedulers differ in how they allocate CPU to threads; in any case, the point of threads is to let a process do multiple things in parallel. Threads share system resources of various kinds, especially memory, files and sockets.
Jobs and tasks are unix shell concepts; a job is a process that a shell launched that is still running, either paused or running in the background. There is a long section on 'job control' in the bash
manual. Job and task are roughly equivalent concepts.
- answered 8 years ago
- G John
Your Answer