Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8400683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:37:18+00:00 2026-06-09T21:37:18+00:00

if we create pthreads (pthread_create) or processes (fork) with default scheduling policies on linux,

  • 0

if we create pthreads (pthread_create) or processes (fork) with default scheduling policies on linux, will the scheduler treats the processes and threads with same priority while scheduling them?

let us say there is process P1 with one thread
and process P2 with 2 threads T1 T2

lets say there is only one core..will the scheduling be
P1 T1 P1 T2 P1 T1 P1 T2

or

P1 T1 T2 P1 T1 T2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:37:19+00:00Added an answer on June 9, 2026 at 9:37 pm

    Linux no longer schedules processes at all.

    Within the kernel, threads are scheduled. The concept of a process is now an artificial construct seen mostly by things outside the kernel. Obviously, the kernel has to know how threads are tied together, but not for scheduling purposes.

    Basically, the kernel maintains a whole lot of threads and each thread has a thread group leader, which is what’s seen on the outside as the process. A thread has a thread ID and a thread group ID – it’s a lot like the relationship between a PID and a PPID (process ID and parent process ID).

    When you create a regular thread, the kernel gives it a brand new thread ID but its thread group ID is set identical to the group ID of the thread that created it. That way, it looks like a thread within a process to the outside world.

    When you fork, the kernel gives it a brand new thread ID and sets its thread group ID to the same value as its thread ID. That way, it looks like a process to the outside world.

    Most non-kernel utilities that report on processes are really just reporting on threads where the thread ID is the same as the thread group ID.

    There are subtleties with other methods which are probably too complicated to go into here. What I’ve written above is (hopefully) a good medium level treatise.

    Now, for your specific question, it would be neither case since P1 only has one thread (there is no P1T2).

    Withing the kernel, the threads are P1T1, P2T1 and P2T2 and, assuming they have the same scheduling properties and behave the same (a), that’s how they’ll be scheduled.


    See also:

    • Linux – Threads and Process;
    • If I have a process, and I clone it, is the PID the same?; and
    • Will a CPU process have at least one thread?

    for more information.


    (a): Obviously that changes if the threads start blocking on I/O (kernel won’t schedule them until I/O is available) or releasing their time quanta early (kernel will probably up their priority as a reward for playing nicely) but then they’re not behaving the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create N threads using pthread_create on Linux/gcc. Each thread writes using for (;;)
CREATE TABLE `tbl_atn` ( `atn_id` int(15) NOT NULL AUTO_INCREMENT, `eng_id` int(15) DEFAULT NULL, `visit`
So I'm trying to create a signal handler using pthreads which works on both
The program is to create several threads where each thread increments a shared variable
I am creating a C++ library for both Linux (with PThreads) and Windows (with
Is there a problem with multiple threads using the same integer memory location between
i'm working with a multi-threaded program (using pthreads) that currently create a background thread
When I create a thread ( pthread_create() ) from my main process, I see
I did not find any tool created for tracing pthread's threads in linux process.
The Linux Kernel is said to be SMP. It is said that processes and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.