TASKS(3PVM)

πŸ“¦ version 3.4.6, in debian bookworm, ubuntu jammy

πŸ‘‘ TASKS(3PVM) β€” bestie, let's go get the tea on your tasks πŸ’…

okay so real talk, this is a page from PVM Version 3.4, and it's all about pvm_tasks β€” the little function that spills everything about the tasks chillin' on your virtual machine. no cap, it's basically the ✨source code✨ behind the console ps command, so you already know it's iconic.


🌸 NAME 🌸

pvm_tasks β€” returns information about the tasks running on the virtual machine. periodt. that's the whole gig.


✨ SYNOPSIS ✨

so here's how you call her in C:

int info = pvm_tasks( int where, int *ntask, struct pvmtaskinfo **taskp )

struct pvmtaskinfo {
int ti_tid;
int ti_ptid;
int ti_host;
int ti_flag;
char *ti_a_out;
} taskp;

and in Fortran:

call pvmftasks( where, ntask, tid, ptid, dtid, flag, aout, info )

like… she serves both languages, we love a bilingual queen 🫢


πŸŽ€ PARAMETERS πŸŽ€

  • where β€” an Integer that says which tasks you wanna hear about. the options are, and I need you to focus bestie:
    • 0 β€” for all the tasks on the virtual machine 🌈
    • pvmd tid β€” for all tasks on a given host 🏠
    • tid β€” for a specific task, just the one, main character energy πŸ‘‘
  • ntask β€” an Integer that returns the number of tasks being reported on. like, the headcount fr fr.
  • taskp β€” returns a pointer to an array of structures holding info about each task: its task ID, parent tid, pvmd task ID, status flag, and the name of this task's executable file. the status flag values are: waiting for a message, waiting for the pvmd, and running. three moods, honestly relatable πŸ’€
  • tid β€” Integer returning task ID of one task.
  • ptid β€” Integer returning parent task ID. yes bestie, we're tracking the parents too 🧚
  • dtid β€” Integer returning pvmd task ID of host task is on.
  • flag β€” Integer returning status of task.
  • aout β€” a Character string returning the name of the spawned task. but lowkey β€” manually started tasks return blank. empty. nada. πŸ™ˆ
  • info β€” the Integer status code returned by the routine. values less than zero mean an error happened, so if you see a negative, something's giving "we have a problem" 😭

πŸ’– DESCRIPTION πŸ’–

so pvm_tasks returns information about tasks presently running on the virtual machine. and here's the slay: the information it hands you is literally the same stuff you'd get from the console command ps. same tea, different mug β˜•

the C function is the overachiever β€” it returns info about the entire virtual machine in one single call. one and done, ate that.

the Fortran function is more of a slow-burn girlie: she returns information about one task per call and cycles through all the tasks. so if where = 0, and you call pvmftasks ntask times, all the tasks will be represented. it's giving… patience πŸ’…

heads up bestie: in Fortran, the reported value of ntask and the set of tasks do not change until the function resets at the end of a complete cycle. but you can reset pvmftasks() at any time by calling it with ntask = -1. boom, fresh start ✨

if pvm_tasks is successful, info will be 0. if some error occurs, then info will be < 0. no in-between, she doesn't do ambiguity πŸŽ€


πŸ¦‹ EXAMPLES πŸ¦‹

C:

struct pvmtaskinfo *taskp;
int i, ntask;

info = pvm_tasks( 0, &ntask, &taskp );
for (i = 0; i < ntask; i++)
          printf("t%x\n", taskp[i].ti_tid);

Fortran:

Do i=1, NTASK
    CALL PVMFTASKS( DTID, NTASK, TID(i), PTID(i), DTID(i),
&                  FLAG(i), AOUT(i), INFO )
EndDo

see? not scary. you got this. πŸ“


πŸ’€ ERRORS πŸ’€

here's the part where things can go sideways. the following error condition can be returned by pvm_tasks:

  • PvmBadParam β€” invalid value for where argument. you gave her something she doesn't recognize, bestie 😭
  • PvmSysErr β€” pvmd not responding. she's ghosting you fr fr πŸ‘»
  • PvmNoHost β€” specified host not in virtual machine. that host? not invited to the party 🚫

🌈 SEE ALSO 🌈

go read these next, they're the supporting cast:

  • pvm_config(3PVM)
  • pvm_tidtohost(3PVM)

and that's the whole page, no crumbs left πŸ’œ this was PVM Version 3.4, dated 31 August, 1994 β€” yes she's an elder but she still serves, iykyk. stan a vintage icon. πŸŽ€βœ¨

πŸ“¦ where this page comes from