银行家算法模拟

Input tips:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-MUhzdb5I-1606364100249)(C:\Users\Marrylin\Desktop\Pictures\image-20201126110234791.png)]

test data1:

7 5 3 0 1 0 7 4 3 3 3 2
3 2 2 2 0 0 1 2 2
9 0 2 3 0 2 6 0 0
2 2 2 2 1 1 0 1 1
4 3 3 0 0 2 4 3 1

P1 1 0 2

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-P3u0ue1q-1606364100254)(C:\Users\Marrylin\Desktop\Pictures\image-20201126111315991.png)]

test data2:

7 5 3 0 1 0 7 4 3 1 0 2
3 2 2 2 0 0 1 2 2
9 0 2 3 0 2 6 0 0
2 2 2 2 1 1 0 1 1
4 3 3 0 0 2 4 3 1

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-J0kcmfOO-1606364100256)(C:\Users\Marrylin\Desktop\Pictures\image-20201126111921907.png)]

test data3:

7 5 3 0 1 0 7 4 3 3 3 2
3 2 2 2 0 0 1 2 2
9 0 2 3 0 2 6 0 0
2 2 2 2 1 1 0 1 1
4 3 3 0 0 2 4 3 1

P1 5 6 7

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-U6ccsrOC-1606364100259)(C:\Users\Marrylin\Desktop\Pictures\image-20201126112059950.png)]

CODE

1. Source

1.1 bankerAlgorithm.c

#include "bankerAlgorithm.h"

// safetyList is the tail of the safety process list
// processList is the head of the unchecked process list
bool isSafety(NODE* safetyList, NODE* processList, int processNum, int* available)
{
    int work[3] = {0};
    memcpy(work, available, 3*sizeof(int));
    bool finish[processNum];
    for (int i=0; i<processNum; i++)
        finish[i] = false;
    // ergodic the number of process times
    for (int i=0; i < processNum; i++)
    {
        int index = 0;
        int finalFlag=0;
        for (NODE* head=processList->next; index < processNum; head=head->next,index++)
        {
            if (!finish[index])
            {
                bool needFlag=true;
                for (int j=0; j < resourcesNum; j++)                    //judge whether need[j] <= work[j]
                    if (head->need[j] > work[j])
                    {
                        needFlag = false;
                        break;
                    }

                if (needFlag)                                           //Step3
                {

                    for (int j=0; j < resourcesNum; j++)                //work[i]=work[i]+allocation[i]
                        work[j] += head->allocation[j];
                    finish[index] = true;
                    safetyCheck(addNode(&safetyList, head));            // add the process into the safetyList
                    break;                                              // goto Step2
                }
                else finalFlag++;
            }
        }
        if (finalFlag == processNum)                                    // at this time, process list is not safety
            break;
    }
    bool result = true;
    for (int i=0; i<processNum; i++)
        result = result&&finish[i];
    return result;                                                  // at this time, process list is safety
}

bool request(NODE** pHead, int* requestVector, int* available, int processNum, int requestProcess)
{
    int index = 0;
    NODE* tHead=*pHead;
    for (; index<=requestProcess && tHead->next; tHead=tHead->next,index++)
        ;
    int* need = tHead->need;
    bool needFlag = true;
    bool availableFlag = true;
    for (int i=0; i < resourcesNum; i++)                            // judge whether request[i]<need[i]
        if (requestVector[i] > need[i])
            needFlag = false;
    if (needFlag)
    {
        for (int i=0; i < resourcesNum; i++)                            // judge whether request[i]<available[i]
            if (requestVector[i] > available[i])
                availableFlag = false;
        if (availableFlag)
        {
            NODE* newHead = NULL;
            NODE* newTail = NULL;
            safetyCheck(createLinked(&newHead, &newTail));            // create a new linked to virtual allocation
            safetyCheck(linkedCopy(newTail, *pHead));
            int newIndex = 0;
            NODE* Head=newHead->next;
            for (; newIndex<=requestProcess && Head->next; Head=Head->next,newIndex++)
                ;
            for (int i=0; i < resourcesNum; i++)
            {
                available[i] -= requestVector[i];                   // available[i] = available[i]-request[i]
                Head->allocation[i] += requestVector[i];            // allocation[i] = allocation[i]+request[i]
                Head->need[i] -= requestVector[i];                  // need[i] = need[i]-request[i]
            }
            NODE* safetyListHead = NULL;
            NODE* safetyListTail = NULL;
            safetyCheck(createLinked(&safetyListHead, &safetyListTail));
            if (isSafety(safetyListTail, newHead->next, processNum, available))
                *pHead = safetyListHead;                              // finish the real assign
            else
            {
                printf("WARNING!\nIt is not safety! Cannot finish the assigning! P%d will be blocked!", requestProcess);
                return false;
            }
        }
        else
        {
            //Pi was blocked.
            printf("WARNING!\nThe request resources are more than available! Cannot finish the assigning! P%d will be blocked!", requestProcess);
            return false;
        }
    }
    else
    {
        printf("ERROR!\nThe request resources are more than need! System has some problem!");
        return false;
    }
    return true;
}

1.2 linkedOperate.c

#include "linkedOperate.h"

bool createLinked(NODE** pHead, NODE** pTail)
{
    *pHead = malloc(sizeof(NODE));
    (*pHead)->next=NULL;
    *pTail = *pHead;
    return true;
}

bool addNode(NODE** pTail, NODE* data)
{
    NODE *tmp = malloc(sizeof(NODE));
    memcpy(tmp, data, sizeof(NODE));
    tmp->next = NULL;
    (*pTail)->next = tmp;
    *pTail = tmp;
    return true;
}

bool linkedCopy(NODE* destination, NODE* resources)
{
    NODE* tail = destination;
    for (NODE* resourcesHead=resources; resourcesHead->next; resourcesHead=resourcesHead->next)
    {
        NODE* newNode = malloc(sizeof(NODE));
        memcpy(newNode, resourcesHead, sizeof(NODE));
        tail->next = newNode;
        tail = newNode;
    }
    return true;
}

void safetyCheck(bool result)
{
    if (!result)
    {
        printf("ERROR! There are something wrong in the linkedOperate file!");
        exit(0);
    }
}

1.3 main.c

#include "test.h"

int main()
{
    test();
}

1.4 test.c

#include "test.h"

void test()
{
    int processNum = 0;
    int available[3] = {0};
    printStdInput();
    char choice;
    scanf("%c",&choice);
    if (choice == '\n')
    {
        NODE* inHead=NULL;
        NODE* inTail=NULL;
        NODE* safetyListHead=NULL;
        NODE* safetyListTail=NULL;
        safetyCheck(createLinked(&inHead, &inTail));
        safetyCheck(createLinked(&safetyListHead, &safetyListTail));
        processNum = initStatusInput(&inTail, available);
        if (isSafety(safetyListTail, inHead, processNum, available))
        {
            int index = 0;
            int requestVector[resourcesNum] = {0};
            printf(" At T0 time, the system is safety! The safety list is: ");
            for (NODE* head=safetyListHead->next; index < processNum; head=head->next, index++)
                printf("%s ",head->name);
            int requestProcess = requestInput(requestVector);
            if (request(&inHead, requestVector, available, processNum, requestProcess))
            {
                printf("*********************************************************************\n");
                printf(" It can be assigned! The safety list is: ");
                index = 0;
                for (NODE* head=inHead->next; index < processNum; head=head->next, index++)
                    printf("%s ", head->name);
                printf("\n\n");
            }
        }
        else
        {
            printf("The system is not safety, Please try again latter!");
            exit(0);
        }
    }

    else
    {
        printf("*********************************************************************\n");
        printf(" Will exit program. ");
        exit(0);
    }
}



void printStdInput()
{
    printf("------------- Welcome to the Banker Algorithm Simulator!-------------\n");
    printf(" Here is a example:\n");
    printf("********************************************************************\n");
    printf("Please input the status array of T0 time(end with EOF):\n");
    printf(" PID       MAX       ALLOCATION     NEED        AVAILABLE\n");
    printf(" P0        7 5 3     0 1 0          7 4 3           3 3 2\n");
    printf(" P1        3 2 2     2 0 0          1 2 2\n");
    printf(" P2        9 0 2     3 0 2          6 0 0\n");
    printf(" P3        2 2 2     2 1 1          0 1 1\n");
    printf(" P4        4 3 3     0 0 2          4 3 1\n");
    printf(" P5        ^Z\n");
    printf("********************************************************************\n");
    printf(" At T0 time, the system is safety! The safety list is: P1 P3 P0 P2 P4\n");
    printf("********************************************************************\n");
    printf("Please input the request array:\n");
    printf("PID        request\n");
    printf("P0         1 0 2\n");
    printf("********************************************************************\n");
    printf(" It can be assigned! The safety list is: P1 P3 P4 P0 P2\n\n");
    printf("Press ENTER to input ...");
}

int initStatusInput(NODE** pTail, int* available)
{
        system("cls");
        int processNum = 0;
        int tmp[9] = {0};
        printf("------------- Welcome to the Banker Algorithm Simulator!-------------\n");
        printf("Please input the status array of T0 time(end with EOF):\n");
        printf(" PID       MAX       ALLOCATION     NEED        AVAILABLE\n");
        printf(" P%d        ", processNum);
        int eof = 0;
        while(~scanf("%d",&eof))
        {
            NODE* tmpNode = malloc(sizeof(NODE));
            tmpNode->name[0] ='P';
            tmpNode->name[1] = processNum + 48;                 // allocation PID
            tmpNode->name[2] = 0;
            // input data
            tmp[0] = eof;
            for (int i=1; i < 9; i++)
                scanf("%d",&tmp[i]);
            if (!processNum)
                for (int i=0; i < 3; i++)
                    scanf("%d",&available[i]);
            // assign data
            for (int i=0; i < 3; i++)
                tmpNode->maxNeed[i] = tmp[i];
            for (int i=0; i < 3; i++)
                tmpNode->allocation[i] = tmp[i + 3];
            for (int i=0; i < 3; i++)
                tmpNode->need[i] = tmp[i + 6];
            safetyCheck(addNode(pTail, tmpNode));
            printf(" P%d        ", ++processNum);
        }
        printf("*********************************************************************\n");
        return processNum;
}

int requestInput(int* request)
{
    int requestProcess = 0;
    printf("\n");
    printf("*********************************************************************\n");
    printf("Please input the request array:\n");
    printf("PID        request\n");
    scanf("P%d", &requestProcess);
    for (int i=0; i < resourcesNum; i++)
        scanf("%d", &request[i]);
    return requestProcess;
}

2. Headeres

2.1 bankerAlgorithm.h

#ifndef BANKERALGORITHM_H_INCLUDED
#define BANKERALGORITHM_H_INCLUDED

#include <stdio.h>
#include <stdbool.h>

#include "linkedOperate.h"
#include "safetyList.h"

#define resourcesNum 3

bool isSafety(NODE* safetyList, NODE* processList, int processNum, int* available);// Security algorithm
bool request(NODE** pHead, int* requestVector, int* available, int processNum, int requestProcess);

#endif // BANKERALGORITHM_H_INCLUDED

2.2 linkedOperate.h

#ifndef LINKEDOPERATE_H_INCLUDED
#define LINKEDOPERATE_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>

#include "safetyList.h"

bool createLinked(NODE** pHead, NODE** pTail);
bool addNode(NODE** pTail, NODE* data);
bool linkedCopy(NODE* destination, NODE* resources);
void safetyCheck(bool result);

#endif // LINKEDOPERATE_H_INCLUDED

2.3 safetyList.h

#ifndef SAFETYLIST_H_INCLUDED
#define SAFETYLIST_H_INCLUDED
#define resourcesNum 3
typedef struct safetyListNode{
    char name[3];
    int allocation[resourcesNum];
    int need[resourcesNum];
    int maxNeed[resourcesNum];              //maxNeed[i] = allocation[i] + need[i]
    struct safetyListNode* next;
}NODE;


#endif // SAFETYLIST_H_INCLUDED

2.4 test.h

#ifndef TEST_H_INCLUDED
#define TEST_H_INCLUDED

#include <stdio.h>
#include <stdlib.h>

#define resourcesNum 3
#define normalInputNum 9

#include "safetyList.h"
#include "linkedOperate.h"
#include "bankerAlgorithm.h"

void test();
void printStdInput();
int initStatusInput(NODE** pTail, int* available);
int requestInput(int* request);

#endif // TEST_H_INCLUDED

四、参考文献
(来自网络)
[1] 当request[i] > need[i]时如何:C语言银行家算法_徐奕的专栏-CSDN博客_银行家算法代码
[2]如何模拟进程阻塞:操作系统实验之银行家算法模拟_这儿有个bug-CSDN博客

银行家算法是避免死锁的一种重要方法,本实验要求用高级语言编写和调试一个简单的银行家算法程序。 设计目的 1)了解多道程序系统中,多个进程并发执行的资源分配。 2)掌握死锁的产生的原因、产生死锁的必要条件和处理死锁的基本方法。 3)掌握预防死锁的方法,系统安全状态的基本概念。 4)掌握银行家算法,了解资源在进程并发执行中的资源分配策略。 5)理解死锁避免在当前计算机系统不常使用的原因 要求: 设计一个n 个并发进程共享m 个系统资源的系统。进程可动态申请资源和释放资源,系统按各进程的申请动态的分配资源。要求采用银行家算法实现。 提示: (1) 初始化这组进程的最大资源请求和依次申请的资源序列。把各进程已占用和需求资源情况记录在进程控制块中。假定进程控制块的内容包括:进程名,状态,当前申请量,资源需求总量,已占资源量,能执行完标志。其中,进程的状态有:就绪、等待和完成。当系统不能满足进程的资源请求时,进程处于等待态。资源需求总量表示进程运行过程中对资源的总的需求量。 已占资源量表示进程目前已经得到但还未归还的资源量。因此,进程在以后还需要的剩余资源量等于资源需要总量减去已占资源量。显然每个进程的资源需求总量不应超过系统拥有的资源总量。 (2) 银行家算法分配资源的原则是:当某个进程提出资源请求时,假定先分配资源给它,然后查找各进程的剩余请求,检查系统的剩余资源量是否由于进程的分配而导致系统死锁。若能,则让进程等待,否则,让进程的假分配变为真分配。 a) 查找各进程的剩余请求,检查系统的剩余资源量是否能满足其中一进程。如果能,则转b)。 b) 将资源分配给所选的进程,这样,该进程已获得资源最大请求,最终能运行完成。标记这个进程为终止进程,并将其占有的全部资源归还给系统。 重复第a)步和第b)步,直到所有进程都标记为终止进程,或直到一个死锁发生。若所有进程都标记为终止进程,则系统的初始状态是安全的,否则为不安全的。若安全,则正式将资源分配给它,否则,假定的分配作废,让其等待。
操作系统课的实验(银行家算法)#include "malloc.h"   #include "stdio.h"   #include "stdlib.h"   #define alloclen sizeof(struct allocation)   #define maxlen sizeof(struct max)   #define avalen sizeof(struct available)   #define needlen sizeof(struct need)   #define finilen sizeof(struct finish)   #define pathlen sizeof(struct path)   struct allocation   {   int value;   struct allocation *next;   };   struct max   {   int value;   struct max *next;   };   struct available /*可用资源数*/   {   int value;   struct available *next;   };   struct need /*需求资源数*/   {   int value;   struct need *next;   };   struct path   {   int value;   struct path *next;   };   struct finish   {   int stat;   struct finish *next;   };   int main()   {   int row,colum,status=0,i,j,t,temp,processtest;   struct allocation *allochead,*alloc1,*alloc2,*alloctemp;   struct max *maxhead,*maxium1,*maxium2,*maxtemp;   struct available *avahead,*available1,*available2,*workhead,*work1,*work2,*worktemp,*worktemp1;   struct need *needhead,*need1,*need2,*needtemp;   struct finish *finihead,*finish1,*finish2,*finishtemp;   struct path *pathhead,*path1,*path2;   printf("\n请输入系统资源的种类数:");   scanf("%d",&colum);   printf("请输入现时内存中的进程数:");   scanf("%d",&row);   printf("请输入已分配资源矩阵:\n");   for(i=0;i<row;i++)   {   for (j=0;jnext=alloc2->next=NULL;   scanf("%d",&allochead->value);   status++;   }   else   {   alloc2=(struct allocation *)malloc(alloclen);   scanf("%d,%d",&alloc2->value);   if(status==1)   {   allochead->next=alloc2;   status++;   }   alloc1->next=alloc2;   alloc1=alloc2;   }   }   }   alloc2->next=NULL;   status=0;   printf("请输入最大需求矩阵:\n");   for(i=0;i<row;i++)   {   for (j=0;jnext=maxium2->next=NULL;   scanf("%d",&maxium1->value);   status++;   }   else   {   maxium2=(struct max *)malloc(maxlen);   scanf("%d,%d",&maxium2->value);   if(status==1)   {   maxhead->next=maxium2;   status++;   }   maxium1->next=maxium2;   maxium1=maxium2;   }   }   }   maxium2->next=NULL;   status=0;   printf("请输入现时系统剩余的资源矩阵:\n");   for (j=0;jnext=available2->next=NULL;   work1->next=work2->next=NULL;   scanf("%d",&available1->value);   work1->value=available1->value;   status++;   }   else   {   available2=(struct available*)malloc(avalen);   work2=(struct available*)malloc(avalen);   scanf("%d,%d",&available2->value);   work2->value=available2->value;   if(status==1)   {   avahead->next=available2;   workhead->next=work2;   status++;   }   available1->next=available2;   available1=available2;   work1->next=work2;   work1=work2;   }   }   available2->next=NULL;   work2->next=NULL;   status=0;   alloctemp=allochead;   maxtemp=maxhead;   for(i=0;i<row;i++)   for (j=0;jnext=need2->next=NULL;   need1->value=maxtemp->value-alloctemp->value;   status++;   }   else   {   need2=(struct need *)malloc(needlen);   need2->value=(maxtemp->value)-(alloctemp->value);   if(status==1)   {   needhead->next=need2;   status++;   }   need1->next=need2;   need1=need2;   }   maxtemp=maxtemp->next;   alloctemp=alloctemp->next;   }   need2->next=NULL;   status=0;   for(i=0;inext=finish2->next=NULL;   finish1->stat=0;   status++;   }   else   {   finish2=(struct finish*)malloc(finilen);   finish2->stat=0;   if(status==1)   {   finihead->next=finish2;   status++;   }   finish1->next=finish2;   finish1=finish2;   }   }   finish2->next=NULL; /*Initialization compleated*/   status=0;   processtest=0;   for(temp=0;temp<row;temp++)   {   alloctemp=allochead;   needtemp=needhead;   finishtemp=finihead;   worktemp=workhead;   for(i=0;istat==0)   {   for(j=0;jnext,worktemp=worktemp->next)   if(needtemp->valuevalue)   processtest++;   if(processtest==colum)   {   for(j=0;jvalue+=alloctemp->value;   worktemp1=worktemp1->next;   alloctemp=alloctemp->next;   }   if(status==0)   {   pathhead=path1=path2=(struct path*)malloc(pathlen);   path1->next=path2->next=NULL;   path1->value=i;   status++;   }   else   {   path2=(struct path*)malloc(pathlen);   path2->value=i;   if(status==1)   {   pathhead->next=path2;   status++;   }   path1->next=path2;   path1=path2;   }   finishtemp->stat=1;   }   else   {   for(t=0;tnext;   finishtemp->stat=0;   }   }   else   for(t=0;tnext;   alloctemp=alloctemp->next;   }   processtest=0;   worktemp=workhead;   finishtemp=finishtemp->next;   }   }   path2->next=NULL;   finishtemp=finihead;   for(temp=0;tempstat==0)   {   printf("\n系统处于非安全状态!\n");   exit(0);   }   finishtemp=finishtemp->next;   }   printf("\n系统处于安全状态.\n");   printf("\n安全序列为: \n");   do   {   printf("p%d ",pathhead->value);   }   while(pathhead=pathhead->next);   printf("\n");   return 0;   } #include "string.h" #include #include #define M 5 #define N 3 #define FALSE 0 #define TRUE 1 /*M个进程对N类资源最大资源需求量*/ int MAX[M][N]={{7,5,3},{3,2,2},{9,0,2},{2,2,2},{4,3,3}}; /*系统可用资源数*/ int AVAILABLE[N]={10,5,7}; /*M个进程对N类资源最大资源需求量*/ int ALLOCATION[M][N]={{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; /*M个进程已经得到N类资源的资源量 */ int NEED[M][N]={{7,5,3},{3,2,2},{9,0,2},{2,2,2},{4,3,3}}; /*M个进程还需要N类资源的资源量*/ int Request[N]={0,0,0}; void main() { int i=0,j=0; char flag='Y'; void showdata(); void changdata(int); void rstordata(int); int chkerr(int); showdata(); while(flag=='Y'||flag=='y') { i=-1; while(i=M) { printf("请输入需申请资源的进程号(从0到"); printf("%d",M-1); printf(",否则重输入!):"); scanf("%d",&i); if(i=M)printf("输入的进程号不存在,重新输入!\n"); } printf("请输入进程"); printf("%d",i); printf("申请的资源数\n"); for (j=0;jNEED[i][j]) { printf("进程"); printf("%d",i); printf("申请的资源数大于进程"); printf("%d",i); printf("还需要"); printf("%d",j); printf("类资源的资源量!申请不合理,出错!请重新选择!\n"); /*printf("申请不合理,出错!请重新选择!\n");*/ flag='N'; break; } else { if(Request[j]>AVAILABLE[j]) { printf("进程"); printf("%d",i); printf("申请的资源数大于系统可用"); printf("%d",j); printf("类资源的资源量!申请不合理,出错!请重新选择!\n"); /*printf("申请不合理,出错!请重新选择!\n");*/ flag='N'; break; } } } if(flag=='Y'||flag=='y') { changdata(i); if(chkerr(i)) { rstordata(i); showdata(); } else showdata(); } else showdata(); printf("\n"); printf("是否继续银行家算法演示,按'Y'或'y'键继续,按'N'或'n'键退出演示: "); scanf("%c",&flag); } } void showdata() { int i,j; printf("系统可用的资源数为:\n"); printf(" "); for (j=0;j<N;j++){ printf(" 资源"); printf("%d",j); printf(":"); printf("%d",AVAILABLE[j]); /*printf("\n");*/ /* cout<<endl; // cout<<"各进程资源的最大需求量:"<<endl<<endl; // for (i=0;i<M;i++) // { // cout<<"进程"<<i<<":"; // for (j=0;j<N;j++)cout<<" 资源"<<j<<": "<<MAX[i][j]; // cout<<endl; */ } printf("\n"); printf("各进程还需要的资源量:\n"); for (i=0;i<M;i++) { printf(" 进程"); printf("%d",i); printf(":"); for (j=0;j<N;j++){ printf("资源"); printf("%d",j); printf(":"); printf("%d",NEED[i][j]); /*printf("\n");*/ } printf("\n"); } printf("各进程已经得到的资源量: \n"); for (i=0;i<M;i++) { printf(" 进程"); printf("%d",i); /*printf(":\n");*/ for (j=0;j<N;j++){ printf("资源"); printf("%d",j); printf(":"); printf("%d",ALLOCATION[i][j]); /*printf("\n");*/ } printf("\n"); } } void changdata(int k) { int j; for (j=0;j<N;j++) { AVAILABLE[j]=AVAILABLE[j]-Request[j]; ALLOCATION[k][j]=ALLOCATION[k][j]+Request[j]; NEED[k][j]=NEED[k][j]-Request[j]; } }; void rstordata(int k) { int j; for (j=0;j<N;j++) { AVAILABLE[j]=AVAILABLE[j]+Request[j]; ALLOCATION[k][j]=ALLOCATION[k][j]-Request[j]; NEED[k][j]=NEED[k][j]+Request[j]; } }; int chkerr(int s) { int WORK,FINISH[M],temp[M]; int i,j,k=0; for(i=0;i<M;i++)FINISH[i]=FALSE; for(j=0;j<N;j++) { WORK=AVAILABLE[j]; i=s; while(i<M) { if (FINISH[i]==FALSE&&NEED[i][j]<=WORK) { WORK=WORK+ALLOCATION[i][j]; FINISH[i]=TRUE; temp[k]=i; k++; i=0; } else { i++; } } for(i=0;i<M;i++) if(FINISH[i]==FALSE) { printf("\n"); printf("系统不安全!!! 本次资源申请不成功!!!\n"); printf("\n"); return 1; } } printf("\n"); printf("经安全性检查,系统安全,本次分配成功。\n"); printf("\n"); printf(" 本次安全序列:"); for(i=0;i"); } printf("\n"); return 0; }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值