Algorithme FIFO et SJF

monchar69 Messages postés 7 Statut Membre -  
 douja -
Bonjour,
je suis a la recherche d'un algorithme FIFO et SJF dynamiques.
S.V.P aidez moi, j'en ai besoin pour resoudre un exercice.
mille merci.
Configuration: Windows XP
Firefox 3.0.4

4 réponses

  1. walid
     
    void main()
    {
    char p[10][5],temp[5];
    int tot=0,wt[10],pt[10],i,j,n,temp1;
    float avg=0;
    clrscr();
    printf("enter no of processes:");
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
    printf("enter process%d name:\n",i+1);
    scanf("%s",&p[i]);
    printf("enter process time");
    scanf("%d",&pt[i]);
    }
    for(i=0;i<n-1;i++)
    {
    for(j=i+1;jpt[j])
    {
    temp1=pt[i];
    pt[i]=pt[j];
    pt[j]=temp1;
    strcpy(temp,p[i]);
    strcpy(p[i],p[j]);
    strcpy(p[j],temp);
    }
    }
    }
    wt[0]=0;
    for(i=1;i<n;i++)
    {
    wt[i]=wt[i-1]+et[i-1];
    tot=tot+wt[i];
    }
    avg=(float)tot/n;
    printf("p_name\t P_time\t w_time\n");
    for(i=0;i<n;i++)
    printf("%s\t%d\t%d\n",p[i],et[i],wt[i]);
    printf("total waiting time=%d\n avg waiting time=%f",tot,avg);
    getch();
    }
    6
    1. douja
       
      c'est pour FIFO ?
      0
  2. monchar69 Messages postés 7 Statut Membre 8
     
    svp j'ai besion de votre aide
    3
  3. Doctor C Messages postés 630 Date d'inscription   Statut Membre Dernière intervention   400
     
    Quel est le but de ton exercice?

    Tu peux regarder wikipedia (en anglais) pour un exemple d'implémentation:
    https://en.wikipedia.org/wiki/FIFO
    0