Berkeley CSUA MOTD:Entry 10350
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/07/09 [General] UID:1000 Activity:popular
7/9     

2003/9/28 [Politics, Computer/SW/Unix] UID:10350 Activity:nil
9/27    Say I want to kill processes older than x hours. If I make a list of PIDs,
        check the start time, and kill on that basis, there is a small
        possibility that that process will terminate after I've done the check
        but before I do the kill, and that another (possibly important) process
        will take on that PID, and I would thus end up killing this important
        process. Is there any way to avoid this race condition without going down
        to kernel level? Thanks.
        \- sure, lots of ways. check ppid, argv string, start time of
           process, etc. the rightway.easiest way probably depends on
           some details of how you are trying to do this but certainly
           you can with ps | awk/grep | (xargs|) kill. --psb
           \_ well, that mitigates it somewhat further, but does not remove the
              essential race condition.
              \- yes it does, if you do it correctly. or do you think
                 something like PAWS isnt good enough either. --psb
                 \_ no, it doesn't.  it's still a race condition.  pipes are
                    not atomic.  you should know better.  there's still a slim
                    chance that between the ps and the kill, the proc exits and
                    another starts.  -!op
              \_ If you check the start time like the first reply suggests, it
                 should eliminate the problem.
                 \_ yes, but what if time wraps around too? :9
                 \_ No, it's not atomic.  Don't they teach Computer Science
                    anymore?  I haven't done real CS in years yet I still know
                    a race condition when I see one.
        \_ There is a race condition, but it doesn't matter.  Running kill on
           a nonexistant PID doesn't hurt anything, and if you've really got a
           system that can wrap around 100k PIDs in the time it takes to run
           your ps | ... | kill, you've got one whacked machine.
2025/07/09 [General] UID:1000 Activity:popular
7/9     

You may also be interested in these entries...
2013/11/4-12/5 [Recreation/Dating, Politics/Domestic/Gay] UID:54752 Activity:nil
11/3    Check this out if you don't want your grade school kids to be forced
        to share bathrooms and shower rooms with the opposite sex:
        http://privacyforallstudents.com
        Only three days left.
        \_^sex^race
           \_ Yes, you are so right, those are exactly the same things.
	...
2013/2/5-3/4 [Politics/Domestic/Immigration] UID:54598 Activity:nil
2/5     http://www.csua.org/u/z5u (news.yahoo.com)
        "I hope no one uses the term 'illegal immigrants' here today," said
        Committee Ranking Member John Conyers of Michigan. "Our citizens are
        not illeg -- the people in this country are not illegal. They are out
        of status."
        How did this guy get himself on the House Judiciary Committee?  Is it
	...
2012/10/19-12/4 [Politics/Domestic/HateGroups, Politics/Domestic/Election] UID:54509 Activity:nil
10/19   Do you think Obama will have to send in troops to put down rioting
        Southern Whites after the election?
        http://partners.nytimes.com/library/national/race/100262race-ra.html
        \_ south = stupid
	...
2011/1/5-2/19 [Politics/Foreign/Asia/Japan, Politics/Domestic] UID:53975 Activity:nil
1/5     Ultra marathon winner-to-be made a wrong turn in the final 100m during
        a 2-day, 217km race:
        http://www.csua.org/u/s8y (sports.yahoo.com)
	...
2010/11/7-2011/1/13 [Politics/Domestic/Election, Politics/Domestic/California/Arnold] UID:53999 Activity:nil
11/7    "Manly man: Russia's Putin roars off in F1 race car"
        http://news.yahoo.com/s/ap/eu_russia_putin_formula_one
        I bet this is yet another gesture in his master plan of doing something
        opposite to Arnie: transitioning from politician to Hollywood Action
        figure.
        \_ As long as you don't talk to a unionized teacher, I think many
	...
2010/8/29-9/30 [Politics/Domestic/California, Politics/Domestic/Immigration] UID:53942 Activity:kinda low
8/29    OC turning liberal, maybe there is hope for CA afterall:
        http://www.nytimes.com/2010/08/30/us/politics/30orange.html
        \_ and the state is slowly turning conservative. Meg 2010!
           \_ We will see. Seems unlikely.
        \_ Yeah, because CA sure has a problem with not enough dems in power!
           If only dems had been running the state for the last 40 years!
	...
2010/3/29-4/14 [Politics/Domestic/Immigration, Politics/Domestic/President] UID:53763 Activity:nil
3/29    http://news.yahoo.com/s/time/20100329/us_time/08599197588300
        "Arabs, who would seem to have an even stronger race claim than
        Hispanics do, are trumpeting their own write-in campaign because the
        Census by default counts them as white ... Ironically, part of the
        problem is that Arab immigrants a century ago petitioned the Federal
        Government to be categorized as white to avoid discrimination."
	...