Changing Quantum in Linux

Post questions regarding programming in C/C++ in Linux/Unix.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

Changing Quantum in Linux

Postby OgreCoder » Fri Apr 02, 2004 9:13 am

I have an assignment where I have to add a system call to the 2.6.3 kernel to both find out what the quatum of the processor is and change it. We can change what they call both MAX_TIMESLICE and MIN_TIMESLICE. I know how to add a system function to the kernel, but does anyone know what variables I am trying to set and how to obtain them. Thank you very much.
OgreCoder
 

Postby Wizard » Fri Apr 02, 2004 3:42 pm

My multithreaded terminology is a little shody, so someone correct me, but isn't the quanta the timeslice between thread flips? Wouldn't that make MAX_TIMESLICE and MIN_TIMESLICE the max and min quantum respectively? I don't understand the problem.
User avatar
Wizard
Site Admin
 
Posts: 3226
Joined: Mon Sep 22, 2003 4:52 pm
Location: ON, CA

Postby OgreCoder » Mon Apr 05, 2004 5:50 am

That is exactly the problem I am working on. MIN and MAX_TIMESLICE are the time between context switches. I need to know how to query these values and change them. They aren't environment variables, so setenv() and getenv() won't work. If any body knows anything, it would be helpful.
OgreCoder
 

Postby Wizard » Tue Apr 06, 2004 4:29 pm

did you try
Code: Select all
MIN_TIMESLICE = 50000;

or something equally simple? If you have, then I'm out of ideas. I've never worked with the Linux kernel, so I'm guessing.
User avatar
Wizard
Site Admin
 
Posts: 3226
Joined: Mon Sep 22, 2003 4:52 pm
Location: ON, CA

Postby sAvAgE » Thu Apr 29, 2004 4:02 am

to access the calls to the kernel in your program for example you can use this

you will need to includethese headers in your code

Code: Select all
#include <unistd.h>
#include <stdio.h>
#include <pthread.h>
#include <sys/stat.h>  //kernel call
#include <sys/types.h> //kernel call
#include <string.h>

also you can read up on the POSIX library Here :)

hope this helps
What is SMP?

It is smoother than a prom queens thigh, yet not as risky ;)
sAvAgE
 
Posts: 9
Joined: Thu Apr 29, 2004 1:31 am


Return to Unix/Linux

Who is online

Users browsing this forum: No registered users and 0 guests