Tuesday, 15 March 2016

System Programming & Operating System Slips Solution

10 comments:

  1. Thank you for sharing useful notes Sir

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Thank you Sir for this solution.
    Your solutions are very easy that it really helped me to understand the logic behind each and every program in no-time.

    Also i would like to say that "I was able to completely understand a total of 38 programs out of 50 which counts to 19-Slips in a span of mere 2 days just with help of your solutions".

    I once find it difficult to solve but then your solutions turned-out a boon for my practicals.

    ReplyDelete
  4. Its very discriptive and well structured
    It helped me a lot to undertand the logic

    thank you so much

    ReplyDelete
  5. Instead Of Doing File Allocation Problem using Linked List use Simple Array and Structure will help u to understand File Allocation easily.(below code help you to understand)



    #include
    #include
    #include
    #include

    typedef struct
    {
    char name[100];
    int start,len;
    }ALLO;

    ALLO f[100];

    int counter=0;

    int create_new_file(int vector[])
    {
    int st,len,j;
    char fname[100];

    printf("\n\tEnter The Name of File? ");
    scanf("%s",fname);
    printf("\n\tEnter Starting Block And Length of File :");
    scanf("%d%d",&st,&len);

    for(j=st;j%d",j,vector[j]);

    if(j==(st+len)-1)
    {
    strcpy(f[counter].name,fname);
    f[counter].start=st;
    f[counter].len=len;
    counter++;
    }

    }
    else
    {
    printf("can't allocate file ...");
    break;
    }
    }


    }

    int show_directory()
    {
    int i;

    printf("FILE NAME START LENGTH\n");
    for(i=0;i<counter;i++)
    {
    printf("%s %d %d\n",f[i].name,f[i].start,f[i].len);
    }
    }

    int delete_file(int vector[])
    {
    char fname[100];
    int i,flag,j;
    printf("\n\tEnter File name to delete from block: ");
    scanf("%s",fname);

    for(i=0;i<counter;i++)
    if(strcmp(fname,f[i].name)==0)
    {
    for(j=f[i].start;j<f[i].start+f[i].len;j++)
    {
    vector[j]=0;
    }
    break;
    }
    for(;i<counter;i++)
    f[i]=f[i+1];

    counter--;

    }
    int main()
    {
    int n,vector[100],i,ch;
    srand(time(NULL));

    printf("How Many Blocks In a Disk?");
    scanf("%d",&n);

    for(i=0;i<n;i++)
    vector[i]=rand()%2;

    do
    {
    printf("\n-----------------------------------------------------\n");
    printf("\n1.Show Bit Vector\n2.Create New File\n3.Show Directory\n4.Delete File\n5.Exit\n\n\tEnter Your Choice?");
    scanf("%d",&ch);

    switch(ch)
    {
    case 1:
    printf("\nAvailable Bit Vectors Are :");
    for(i=0;i<n;i++)
    printf("[ %d ]",vector[i]);
    break;
    case 2:create_new_file(vector);
    break;
    case 3:show_directory();
    break;
    case 4:delete_file(vector);
    break;
    }

    }while(ch!=5);
    }

    same way u can do other Allocation method.

    ReplyDelete
  6. Saved my practical exams❤😁😇

    ReplyDelete
  7. How execute the shell program..normal like c ??? Plzz send me d steps

    ReplyDelete
  8. Hey,

    Thanks for sharing your knowledge with us

    Pune University

    ReplyDelete