views:

323

answers:

3

So a OS multi-tasks and runs one process at a given moment (assuming it's a single core machine). Is there a way I can track/poll and find which process was running at what time and at what time it was put in the queue and retrieved back. Are there any system calls for this ?. Is there a way to achieve this without modifying the linux kernel's source.

A: 

I don't think you can do this natively. AFAIK linux does not a keep a history track of this information.

Nuno Furtado
+3  A: 

I think you need lttng, it definitely give a you a elaborate view of the system's task switch thing(and much more than that) with the lttng viewer. Lttng's kernel part has been merged to current Linux kernel, and you can use it if your kernel has enabled this feature. Here is some screen shots for lttng.

arsane
This is exactly what I was looking for. Thank you. :)
Ankur Gupta
A: 

That's an illogical question. If you are querying the OS from a script/process then the active program is ... YOURS.

Though I guess if you want the history you could watch the /proc directory or the output from ps

SpliFF
It's not a illogical question. Perhaps it's not well formed/ put properly.
Ankur Gupta
If you have a single core, whichever process is doing the monitoring is bound to discover that it, itself is running.
MarkR