Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

Debug
[Multitasking]


Functions

void ps ()
 Print the state of every process from the ready, wait and zombie queues.


Detailed Description

Debug procedures for multitasking.

Function Documentation

void ps (    ) 
 

Print the state of every process from the ready, wait and zombie queues.

Definition at line 1234 of file task.c.

01235 {
01236         task_t *p;
01237         int count, i;
01238 
01239         if ((p = curr_task)==NULL) return;
01240 
01241         // Header //
01242         kprintf("\n\rPID       STATE       CONSOLE     CMD");
01243 
01244         sched_enter_critical_region();
01245 
01246         // Ready processes //
01247         for(i=0, count=count_queue(&ready_queue); i<count; i++)
01248         {
01249                 // Get the next task in the ready queue //
01250                 p = pick_queue(&ready_queue);
01251 
01252                 // Print process informations //
01253                 kprintf("\n\r%u", p->pid);
01254                 gotoxy(12, -1);
01255                 kputchar('R');
01256                 gotoxy(22, -1);
01257                 if (p->console)
01258                         kprintf("tty%u", p->console);
01259                 else
01260                         kputchar('?');
01261                 gotoxy(34, -1);
01262                 kprintf("%s", p->name);
01263         }
01264 
01265         // Wait processes //
01266         for(i=0, count=count_queue(&wait_queue); i<count; i++)
01267         {
01268                 // Get the next task in the wait queue //
01269                 p = pick_queue(&wait_queue);
01270 
01271                 // Print process informations //
01272                 kprintf("\n\r%u", p->pid);
01273                 gotoxy(12, -1);
01274                 kputchar('W');
01275                 gotoxy(22, -1);
01276                 if (p->console)
01277                         kprintf("tty%u", p->console);
01278                 else
01279                         kputchar('?');
01280                 gotoxy(34, -1);
01281                 kprintf("%s", p->name);
01282         }
01283 
01284         // Zombie processes //
01285         for(i=0, count=count_queue(&zombie_queue); i<count; i++)
01286         {
01287                 // Get the next task in the zombie queue //
01288                 p = pick_queue(&zombie_queue);
01289 
01290                 // Print process informations //
01291                 kprintf("\n\r%u", p->pid);
01292                 gotoxy(12, -1);
01293                 kputchar('Z');
01294                 gotoxy(22, -1);
01295                 if (p->console)
01296                         kprintf("tty%u", p->console);
01297                 else
01298                         kputchar('?');
01299                 gotoxy(34, -1);
01300                 kprintf("%s", p->name);
01301         }
01302 
01303         sched_leave_critical_region();
01304 
01305         kprintf("\n\r");
01306 }


Generated on Fri Feb 20 15:32:23 2004 for Minirighi by doxygen1.2.18