[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

280.0. "Phone: Z TO ILLOGICAL Directory." by LOTUS::ATTWOOL (A legend in his own lunch time) Mon Aug 04 1986 11:55

    
    
        Has anyone ever had a thought at why VAX PHONE puts usernames in a
    totally illogical order when doing a directory. Why does it not be
    uniform and put them in alphabetical order !!
     Does VAX phone get its interactive user information the same way as
    "Show users" ?
    
    	Anyone care to elaborate ..?? 
    
    	Jka
                  
T.RTitleUserPersonal
Name
DateLines
280.1sorted by PID?GVASA::REGINARegina Haase-Rohr, IS GenevaMon Aug 04 1986 12:415
    I sometimes got the impression that phone dir displays first logged-in
    first in the list. Could it be?
    
    rhr
    
280.2PHONE is lazy...WHOARU::MCCARTHYError Message #000000Mon Aug 04 1986 13:5413

	The PHONE utility does it the easy way!  What I mean by that is 
  it uses the system process id numbers.  Which, by the way, are in order 
  of logins.

	The $GETJPI system service which will, upon repeated calls, return 
the pid of the next process.  I wrote a program in PASCAL that used $GETJPI 
to check for process that had terminals.  PHONE may do the same thing.  I 
have since added a sort routine to the program because, well, it looks better 
(and too may complaints).

Brian
280.3CAFEIN::PFAUI brake for ferretsMon Aug 04 1986 22:4133
    PID's are NOT returned in the order of login.  PID's have the same
    format on V4 as they had on V3 (more or less).  They are composed
    of an index and a use count (plus cluster node information if the
    system is part of a cluster).  The low order bits make up the index.
    The number of bits used for the index varies depending on
    MAXPROCESSCNT.
    
    When a user logs in, the first available process slot (the one with
    the lowest index) is used.  The use count for that slot is incremented.
    
    For example, assume MAXPROCESSCNT = 16 (^X10).  Four bits will be used
    for the index.  NULL = 10, SWAPPER = 11, SYSINIT gets 12, JOB_CONTROL
    gets 13, SYSINIT logs out.  First user (USERA) gets 22 (slot 2, second
    process to use that slot).  Second user (USERB) gets 14.  Third
    user (USERC) gets 15.  USERB logs out.  Fourth user (USERD) gets
    24.  $GETJPI will return processes in the following order:
    
    	10 (NULL)
    	11 (SWAPPER)
    	22 (USERA)
    	13 (JOB_CONTROL)
    	24 (USERD)
    	15 (USERC)
    
    This is neither alphabetical nor in order of login.
    
    Both PHONE and SHOW USERS use $GETJPI to find out who's logged in.
    SHOW USERS sorts the information before display, PHONE doesn't.
    Since SHOW USERS has to collect all the information first in order
    to sort it, it can display a count of users at the top of the list.
    PHONE counts and displays as it goes so the count is at the end.
    
    tom_p
280.4slightly wrongJON::MORONEYMadmanMon Aug 04 1986 23:5411
re .3:  Minor correction:  It's not the _first_ free process slot that gets
used - it is the _next available slot_ after the last created process. In other
words, in the example given, the first user (USERA) will get 14, the next
(USERB) will get 15, and so on thru 1F.  The next user will get 22 (since
SYSINIT logged out), and if the only other one to log out in this time is the
person who got # 19, the next user will get 29.  This was just verified by
several $ SPAWN SHOW SYSTEMs in rapid succession on an unloaded system. 

Perhaps it is done this way to be sure all process slots wear evenly? :-)

-Mike
280.5Thank you for the correctionWHOARU::MCCARTHYError Message #000000Tue Aug 05 1986 09:026
	Sorry about the incorrect info on PID's.  It has been a while since
  I played with that stuff.  I relized my error last night.

An ex-system hacker (school),
Brian
280.6ERIS::CALLASJon CallasTue Aug 05 1986 11:0910
    The first available slot was how it was done before V4, so don't feel
    bad. 
    
    The new scheme is done precisely so that the slots wear more evenly
    (beleive it or not). The reason is that you want PIDs to be (mostly)
    unique. You don't want any confusion about pids. The new scheme ensures
    that it will take longer for the pid count to roll over and two
    processes have the name pid. 
    
    	Jon
280.7CAFEIN::PFAUI brake for ferretsTue Aug 05 1986 17:555
    That's interesting.  I had never noticed that.  It does sound logical,
    though, to start the search for a free slot from the last slot used
    instead of from the top.
    
    tom_p