linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: How can I know the number of current users in the system?
       [not found] <sbe793a0.090@mail-01.med.umich.edu>
@ 2001-11-06 13:44 ` Terje Eggestad
  2001-11-06 14:40   ` Richard B. Johnson
  0 siblings, 1 reply; 9+ messages in thread
From: Terje Eggestad @ 2001-11-06 13:44 UTC (permalink / raw)
  To: Nicholas Berry; +Cc: amon, weixl, mlist-linux-kernel

Absolutly true. 

You can get a 90% solution by testing for tty and for proces that has a
connection to a tcp port between 6000 and 6100 somewhere or has a unix
socket to /tmp/.X11-unix/X0 (or whereever X chooses to place the unix
socket). 

But thats definitly not good enough to base your scheduling on.

TJ

tir, 2001-11-06 kl. 13:38 skrev Nicholas Berry:
    It depends whether you're looking for an idea of who's on, or you want a definitive count. The lattter is basically almost impossible. What if a logged-in user nohups two xterms to different X-servers, then logs out - how many people are logged in? I've spent a hell of a long time working on this on AIX for a certain German bank, and the bottom line is that it can't be done. What is 'logged on' anyway? Someone running bash or ksh, that's cool, but what about someone running /home/fred/myprog? Is it a shell?
    
    Basically once Unix went beyond serial terminals connected to dumb serial ports, we lost the ability to track users.
    
    Nik
    
    
    > Hmmm, you should be able to count the number of pty's and tty's.
    > Every logged in user is attached to some sort of getty
    > whose parent is the init task (1). That might be a basis for
    > a count.
    
-- 
_________________________________________________________________________

Terje Eggestad                  terje.eggestad@scali.no
Scali Scalable Linux Systems    http://www.scali.com

Olaf Helsets Vei 6              tel:    +47 22 62 89 61 (OFFICE)
P.O.Box 70 Bogerud                      +47 975 31 574  (MOBILE)
N-0621 Oslo                     fax:    +47 22 62 89 51
NORWAY            
_________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How can I know the number of current users in the system?
  2001-11-06 13:44 ` How can I know the number of current users in the system? Terje Eggestad
@ 2001-11-06 14:40   ` Richard B. Johnson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard B. Johnson @ 2001-11-06 14:40 UTC (permalink / raw)
  To: Terje Eggestad; +Cc: Nicholas Berry, amon, weixl, mlist-linux-kernel

On 6 Nov 2001, Terje Eggestad wrote:

> Absolutly true. 
> 
> You can get a 90% solution by testing for tty and for proces that has a
> connection to a tcp port between 6000 and 6100 somewhere or has a unix
> socket to /tmp/.X11-unix/X0 (or whereever X chooses to place the unix
> socket). 
> 
> But thats definitly not good enough to base your scheduling on.
> 
> TJ

If you don't mind having your Web-Server with 1000 connections/second
be a "single user", just scan for all the unique UID/GID pairs.
All the root processes are one "user", the lpd is another user,
Apache is another user, login-joe is another user, etc. The total
number of tasks is the number of directories that represent digits
in /proc.


Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

    I was going to compile a list of innovations that could be
    attributed to Microsoft. Once I realized that Ctrl-Alt-Del
    was handled in the BIOS, I found that there aren't any.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How can I know the number of current users in the system?
@ 2001-11-06 14:21 Telford002
  0 siblings, 0 replies; 9+ messages in thread
From: Telford002 @ 2001-11-06 14:21 UTC (permalink / raw)
  To: nikberry, terje.eggestad, amon; +Cc: weixl, mlist-linux-kernel

In a message dated 11/6/01 8:01:08 AM Eastern Standard Time, 
nikberry@med.umich.edu writes:

> Basically once Unix went beyond serial terminals connected to dumb serial 
> ports, we lost the ability to track users.

I would have phrased the comment somewhat different.

Once Unix adopted the process and file I/O abstraction,
a system wide user count became meaningless.

Unix should be contrasted with Primos or VMS where the
user memory space or program and serial terminal I/O 
are used in defining the multiuser time-sharing capabilities
of the system.

Joachim Martillo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How can I know the number of current users in the system?
@ 2001-11-06 12:38 Nicholas Berry
  0 siblings, 0 replies; 9+ messages in thread
From: Nicholas Berry @ 2001-11-06 12:38 UTC (permalink / raw)
  To: terje.eggestad, amon; +Cc: weixl, mlist-linux-kernel

It depends whether you're looking for an idea of who's on, or you want a definitive count. The lattter is basically almost impossible. What if a logged-in user nohups two xterms to different X-servers, then logs out - how many people are logged in? I've spent a hell of a long time working on this on AIX for a certain German bank, and the bottom line is that it can't be done. What is 'logged on' anyway? Someone running bash or ksh, that's cool, but what about someone running /home/fred/myprog? Is it a shell?

Basically once Unix went beyond serial terminals connected to dumb serial ports, we lost the ability to track users.

Nik


> Hmmm, you should be able to count the number of pty's and tty's.
> Every logged in user is attached to some sort of getty
> whose parent is the init task (1). That might be a basis for
> a count.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How can I know the number of current users in the system?
  2001-11-06  9:28 ` Terje Eggestad
@ 2001-11-06 12:03   ` Dale Amon
  0 siblings, 0 replies; 9+ messages in thread
From: Dale Amon @ 2001-11-06 12:03 UTC (permalink / raw)
  To: Terje Eggestad; +Cc: weixl, mlist-linux-kernel

On Tue, Nov 06, 2001 at 10:28:57AM +0100, Terje Eggestad wrote:
> 
> My suggestion is to loop thru the processes and collect a list of all
> the userids and form a tree/list of all the processes belonging to each
> of them. Then you fair share schedule between the users.

Hmmm, you should be able to count the number of pty's and tty's.
Every logged in user is attached to some sort of getty
whose parent is the init task (1). That might be a basis for
a count.

-- 
------------------------------------------------------
    Nuke bin Laden:           Dale Amon, CEO/MD
  improve the global          Islandone Society
     gene pool.               www.islandone.org
------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How can I know the number of current users in the system?
  2001-11-04 22:15 Wei Xiaoliang
  2001-11-05  7:47 ` Riley Williams
@ 2001-11-06  9:28 ` Terje Eggestad
  2001-11-06 12:03   ` Dale Amon
  1 sibling, 1 reply; 9+ messages in thread
From: Terje Eggestad @ 2001-11-06  9:28 UTC (permalink / raw)
  To: weixl; +Cc: mlist-linux-kernel

The short answer is; No.

The slightly longer answer is that Linux/Unix kernels don't have a
consept of a logged in user. userids are used for really only one thing,
owner ship of data. In order to do enforce it a process must be running
as a spesific user. Once programs had a userid attached to it, things
rolled on from there. However there is no way of figuring out if a
process is "online" or something else.

However, the big iron *ix'es do this, and I can't remember exactly how
they do it. But another feature often pop up; guaranteeing a users a
minimum CPU percentage. (Even if I hate it, it has merit for RT/responce
critical apps.)

My suggestion is to loop thru the processes and collect a list of all
the userids and form a tree/list of all the processes belonging to each
of them. Then you fair share schedule between the users.

Another issue: did you want to serialize scheduling? (run all the
processes for a user in sequence before starting on the next user?)
Another feature on the "big" *ix'es. 

THis is going to have some side effects! nicing a process up or down may
only nice relative to the users other processes, not other users. It may
be what you want, just thought I'd bring it up. 

Next issue, do you want to fair share between root and the other users?
(and THAT is a time old discussion...)

TJ


søn, 2001-11-04 kl. 23:15 skrev Wei Xiaoliang:
> Hi every one,
>     I have a problem not clear: Is there any counter for the user number
> in linux?
> I want to do anexperiment which will get the number of current user in
> the system and try fair-share scheduling based on it. I read the sys.c
> and user.c but cannot find a counter for it. Is there any counter for
> this things?
> 
>     If no, where can I put the inc instruct and dec instruct  or the
> counter? in the uid_hash_insert and uid_hash_remove?
>     Thank you!
> -----------------------------------------------------------------------
> Xiaoliang (David) Wei                    Graduate Student in CS, Caltech
> E-mail: weixl@caltech.edu                Office: 158 Jorgensen
> Phone: 1-(626)-395-3555 (O)        1-(626)-577-5238 (H)
> Mail:     Xiaoliang Wei, 256-80 Caltech, Pasadena, CA 91125, U.S.A.
> WWW: http://www.cs.caltech.edu/~weixl    http://166.111.69.241/~wxl
> -----------------------------------------------------------------------
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
-- 
_________________________________________________________________________

Terje Eggestad                  terje.eggestad@scali.no
Scali Scalable Linux Systems    http://www.scali.com

Olaf Helsets Vei 6              tel:    +47 22 62 89 61 (OFFICE)
P.O.Box 70 Bogerud                      +47 975 31 574  (MOBILE)
N-0621 Oslo                     fax:    +47 22 62 89 51
NORWAY            
_________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How can I know the number of current users in the system?
  2001-11-05  7:47 ` Riley Williams
@ 2001-11-06  1:20   ` Chris Abbey
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Abbey @ 2001-11-06  1:20 UTC (permalink / raw)
  To: Linux Kernel

Today, Riley Williams wrote:
> Here's a simple shell command to provide that information:
>
> 	who | wc -l
>
> Try it and see...

Actually that's not a fair count of the number of users on the box,
only the number that are *logged in*. On one of our boxes at work,
that would miss about 80% of the users, maybe more. Anyone that
RSH's or SSH's in without a tty wouldn't be counted:

cabbey@CHESIRE ~> ssh -T tweedle who
cabbey@CHESIRE ~>

so even though I was executing who on tweedle it didn't see me
logged in. A more realistic situation:

[cabbey@tweedle cabbey]$ who
cabbey   pts/0    Nov  5 19:05
cabbey   pts/1    Nov  5 19:05
[cabbey@tweedle cabbey]$

pts/0 is my pine session, pts/1 is the shell I executed who in,
there are also two copies of "xeyes" running back to chesire
that were started as 'ssh -T tweedle /usr/X11r6/bin/xeyes -display
chesire:0' but don't appear in who

going back to running it remotely:

cabbey@CHESIRE ~> ssh -T tweedle who
cabbey   pts/0    Nov  5 19:05
cabbey   pts/1    Nov  5 19:05
cabbey@CHESIRE ~>

If those were move cpu hungry programs than xeyes,
like vncserver with a complete kde/gnome desktop
running under it then you could really be missing
some data from a scheduling pov... which as I recall
was what the original poster wanted to fiddle with.

-- 
now the forces of openness have a powerful and
  unexpected new ally - http://ibm.com/linux



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How can I know the number of current users in the system?
  2001-11-04 22:15 Wei Xiaoliang
@ 2001-11-05  7:47 ` Riley Williams
  2001-11-06  1:20   ` Chris Abbey
  2001-11-06  9:28 ` Terje Eggestad
  1 sibling, 1 reply; 9+ messages in thread
From: Riley Williams @ 2001-11-05  7:47 UTC (permalink / raw)
  To: Wei Xiaoliang; +Cc: Linux Kernel

Hi Wei.

> I have a problem not clear: Is there any counter for the user number
> in linux?

> I want to do anexperiment which will get the number of current user
> in the system and try fair-share scheduling based on it. I read the
> sys.c and user.c but cannot find a counter for it. Is there any
> counter for this things?

Here's a simple shell command to provide that information:

	who | wc -l

Try it and see...

Best wishes from Riley.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* How can I know the number of current users in the system?
@ 2001-11-04 22:15 Wei Xiaoliang
  2001-11-05  7:47 ` Riley Williams
  2001-11-06  9:28 ` Terje Eggestad
  0 siblings, 2 replies; 9+ messages in thread
From: Wei Xiaoliang @ 2001-11-04 22:15 UTC (permalink / raw)
  To: mlist-linux-kernel

Hi every one,
    I have a problem not clear: Is there any counter for the user number
in linux?
I want to do anexperiment which will get the number of current user in
the system and try fair-share scheduling based on it. I read the sys.c
and user.c but cannot find a counter for it. Is there any counter for
this things?

    If no, where can I put the inc instruct and dec instruct  or the
counter? in the uid_hash_insert and uid_hash_remove?
    Thank you!
-----------------------------------------------------------------------
Xiaoliang (David) Wei                    Graduate Student in CS, Caltech
E-mail: weixl@caltech.edu                Office: 158 Jorgensen
Phone: 1-(626)-395-3555 (O)        1-(626)-577-5238 (H)
Mail:     Xiaoliang Wei, 256-80 Caltech, Pasadena, CA 91125, U.S.A.
WWW: http://www.cs.caltech.edu/~weixl    http://166.111.69.241/~wxl
-----------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-11-06 14:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <sbe793a0.090@mail-01.med.umich.edu>
2001-11-06 13:44 ` How can I know the number of current users in the system? Terje Eggestad
2001-11-06 14:40   ` Richard B. Johnson
2001-11-06 14:21 Telford002
  -- strict thread matches above, loose matches on Subject: below --
2001-11-06 12:38 Nicholas Berry
2001-11-04 22:15 Wei Xiaoliang
2001-11-05  7:47 ` Riley Williams
2001-11-06  1:20   ` Chris Abbey
2001-11-06  9:28 ` Terje Eggestad
2001-11-06 12:03   ` Dale Amon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).