Discussion:
ps.exe showing when runnin ps
(too old to reply)
Eran Kravitz
2005-09-16 01:02:33 UTC
Permalink
Quick question, should ps itself be included in the table when running
the ps command? If so, is it considered runnable?.

Thank you.
Iulian Neamtiu
2005-09-17 04:38:03 UTC
Permalink
Post by Eran Kravitz
Quick question, should ps itself be included in the table when running
the ps command? If so, is it considered runnable?.
Thank you.
Well, yes, it is actually running because it's the one calling Sys_PS
when you take the snapshot.
You have a good point: ps is *running*, and some other processes in the
runqueue are *runnable*, i.e. not blocked and waiting their turn for a
quantum. I presume showing 'R' is OK, although to me there should be a
distinction between runnable and running. Ask the TAs or Dr. Hicks, but
in the meantime print 'R'; you can easily change it later.

Iulian
Saurabh Srivastava
2005-09-17 14:35:38 UTC
Permalink
I second Iulian's opinion. ps.exe should show up in the list of processes
and it is fine to just label is as 'R' along with the other runnable
threads. ie you dont need to make a distinction between runnable and
running processes (partly because this is what we are used to in unix
anyway).

| Eran Kravitz wrote:
| > Quick question, should ps itself be included in the table when running
| > the ps command? If so, is it considered runnable?.
| >
| > Thank you.
|
| Well, yes, it is actually running because it's the one calling Sys_PS
| when you take the snapshot.
| You have a good point: ps is *running*, and some other processes in the
| runqueue are *runnable*, i.e. not blocked and waiting their turn for a
| quantum. I presume showing 'R' is OK, although to me there should be a
| distinction between runnable and running. Ask the TAs or Dr. Hicks, but
| in the meantime print 'R'; you can easily change it later.
c***@CSIC.UMD.EDU
2005-09-17 22:23:38 UTC
Permalink
I am not able to use malloc in ps.c.

If i include geekos/malloc.h instead of malloc.h then i get a
message saying cannot use Malloc in user space.


Any suggestions ?
Daniel Ramsbrock
2005-09-17 23:15:35 UTC
Permalink
Yes--use static allocation instead of dynamic allocation (which doesn't
work in user space and is not supposed to either). Hint: try to figure
out what the max number of processes is that you might have to store in
the ps table, and then allocate enough memory at compile time.

If the current ps table won't fit into the (statically allocated) space
provided by ps.exe, that's when you return zero from Sys_PS.

Daniel
Post by c***@CSIC.UMD.EDU
I am not able to use malloc in ps.c.
If i include geekos/malloc.h instead of malloc.h then i get a
message saying cannot use Malloc in user space.
Any suggestions ?
c***@CSIC.UMD.EDU
2005-09-17 23:31:51 UTC
Permalink
Yeah i did that.

I having some weird problem with ps that it works when i use the
ps.exe for the first time, everytime after that it complains about
invalid executable file

Continue reading on narkive:
Loading...