6 Replies - 232 Views - Last Post: 12 September 2019 - 04:56 PM Rate Topic: -----

#1 fearfulsc2   User is offline

  • D.I.C Regular

Reputation: 16
  • View blog
  • Posts: 276
  • Joined: 25-May 16

Aging Processes to Solve Starving Process Problem

Posted 06 September 2019 - 07:21 AM

Hi everyone,

I am trying to find a way to increase the priority of a process that is being starved and I am unable to get around that issue right now.

I tried to increment by 1 but I am not getting the desired response

for (i = 0; i < NPROC; i++) 
 {
        prptr = &proctab[i];

		// makes sure to skip incrementing the null process' priority
		if(getprio(i) == NULLPROC)
		{
			continue;
		}
        if (prptr->prstate == PR_READY) 
        {  
	    /* skip unused slots	*/
            chprio(i, getprio(i) + 1);
        }
}



any insights on this?

Is This A Good Question/Topic? 0
  • +

Replies To: Aging Processes to Solve Starving Process Problem

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15215
  • View blog
  • Posts: 60,898
  • Joined: 12-June 08

Re: Aging Processes to Solve Starving Process Problem

Posted 06 September 2019 - 07:29 AM

What is managing these processes?

Something you wrote? Some environment?
Was This Post Helpful? 0
  • +
  • -

#3 fearfulsc2   User is offline

  • D.I.C Regular

Reputation: 16
  • View blog
  • Posts: 276
  • Joined: 25-May 16

Re: Aging Processes to Solve Starving Process Problem

Posted 06 September 2019 - 07:33 AM

It's the OS I am programming on

sid32 sem1;

int main(int argc, char **argv)
{
    sem1 = semcreate(0);
    pid32 pid1, pid2, pid3;

    	/* Check argument count */
    
    pid1 = resume(create(waiter, 1024, 40, "P1", 0));
    pid2 = resume(create(signaler, 1024, 35, "P2", 0));
    pid3 = resume(create(starvingProcess, 1024, 25, "P3", 0));

    return OK;
}



It is using a priority based scheduling policy.

It only runs on a single core so only one process at a time can run.

I wanted to test context switching by using semaphores so that every time resched() is called, all processes in the ready state would be incremented while the process in the waiting state and the process in the current state would not be incremented. I don't think I'm doing the incrementing properly.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15215
  • View blog
  • Posts: 60,898
  • Joined: 12-June 08

Re: Aging Processes to Solve Starving Process Problem

Posted 06 September 2019 - 08:22 AM

Are pid32 & sid32 your own creations?
Was This Post Helpful? 0
  • +
  • -

#5 fearfulsc2   User is offline

  • D.I.C Regular

Reputation: 16
  • View blog
  • Posts: 276
  • Joined: 25-May 16

Re: Aging Processes to Solve Starving Process Problem

Posted 06 September 2019 - 10:34 AM

They are OS defined datatypes.
pid32 is effectively an integer as well as sid32.
They are defined in the kernel.h file

typedef	int32	sid32;		/* semaphore ID				*/
typedef	int16	qid16;		/* queue ID				*/
typedef	int32	pid32;		/* process ID				*/


Was This Post Helpful? 0
  • +
  • -

#6 unixplumber   User is offline

  • New D.I.C Head

Reputation: 8
  • View blog
  • Posts: 9
  • Joined: 02-January 19

Re: Aging Processes to Solve Starving Process Problem

Posted 11 September 2019 - 10:07 AM

  • Which OS? It appears to be XINU. Is that correct?
  • Can you provide a minimal but complete code example (see https://stackoverflo...ducible-example )? Small code snippets are generally useless if you want anyone to help.

Was This Post Helpful? 0
  • +
  • -

#7 fearfulsc2   User is offline

  • D.I.C Regular

Reputation: 16
  • View blog
  • Posts: 276
  • Joined: 25-May 16

Re: Aging Processes to Solve Starving Process Problem

Posted 12 September 2019 - 04:56 PM

It is a XINU os.

I'm not sure how I can give a minimal but complete version of that. But I can provide what I am doing
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1