AW: Antwort: AW: linux-l: AW: Zwei Dateien vergleichen

Vogler, Hartmut Hartmut.Vogler at telekom.de
Fr Apr 16 12:18:44 CEST 1999


> Ist auch nicht ganz korrekt. Bei der Neuvergabe der PID's werden nur die
> freien
> Nummern vergeben. Eingeschraenkt ist nur die Gesamtzahl der parallel
> laufenden
> Prozesse (halt 32768).
> 
> 
Da man diesen Thread noch Jahre weiter führen kann, hier nun die finale
Aussage:
Kernelauszug:

static int get_pid(unsigned long flags)
{
        static int next_safe = PID_MAX;
        struct task_struct *p;

        if (flags & CLONE_PID)
                return current->pid;

        spin_lock(&lastpid_lock);
        if((++last_pid) & 0xffff8000) {
                last_pid = 300;         /* Skip daemons etc. */
                goto inside;
        }
        if(last_pid >= next_safe) {
inside:
                next_safe = PID_MAX;
                read_lock(&tasklist_lock);
        repeat:
                for_each_task(p) {
                        if(p->pid == last_pid   ||
                           p->pgrp == last_pid  ||
                           p->pgrp == last_pid  ||
                           p->session == last_pid) {
                                if(++last_pid >= next_safe) {
                                        if(last_pid & 0xffff8000)
                                                last_pid = 300;
                                        next_safe = PID_MAX;
                                        goto repeat;
                                }
                        }
                        if(p->pid > last_pid && next_safe > p->pid)
                                next_safe = p->pid;
                        if(p->pgrp > last_pid && next_safe > p->pgrp)
                                next_safe = p->pgrp;
                        if(p->session > last_pid && next_safe > p->session)
                                next_safe = p->session;
                }
                read_unlock(&tasklist_lock);
        }
        spin_unlock(&lastpid_lock);

        return last_pid;
}

Ich hoffe wir können uns nun wieder wichtigen Dingen witmen.



Mehr Informationen über die Mailingliste linux-l