sched_child_runs_first doesn't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I ran my test code but always got the father process run first, even
after setting sched_child_runs_first. Could anyone give me a hint?
Here is my test code.

#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>

int main(void)
{
    struct timeval tv;
    struct timezone tz;
    int err;
    pid_t ret = fork();

    if (ret == 0) {
        err = gettimeofday(&tv, &tz);
        if (!err)
            printf("child time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);

         printf("this child.\n");
    } else if (ret > 1) {
        err = gettimeofday(&tv, &tz);

        if (!err)
            printf("father time sec %d, usec %d\n", tv.tv_sec, tv.tv_usec);
        printf("this father.\n");
    } else
        printf("err!!\n");
    return 0;
}


-- 
Cheers,
Rock

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux