C语言创建新进程模拟PCB作用,操作系统,模拟进程管理之PCB块管理法,C语言实现...

首先大家祝福平安夜快乐啊,今天要发布的代码是一款C语言编写的模拟操作系统管理进程的程序调试环境TC,使用了PCB进行进程管理控制,建立三个基本的队列:等待、执行、阻塞进行模拟操作系统的进程管理,模拟进程的调度,模拟用户的创建、执行、阻塞、挂起、唤醒等操作最近要准备准备操作系统考试,所以放一个程序跟大家分享代码如下:/**yctc cg*/#include "stdio.h"#include "do...
摘要由CSDN通过智能技术生成

首先大家祝福平安夜快乐啊,今天要发布的代码是一款C语言编写的模拟操作系统管理进程的程序调试环境TC,使用了PCB进行进程管理控制,建立三个基本的队列:等待、执行、阻塞进行模拟操作系统的进程管理,模拟进程的调度,模拟用户的创建、执行、阻塞、挂起、唤醒等操作

最近要准备准备操作系统考试,所以放一个程序跟大家分享

代码如下:

/*

*yctc cg

*/

#include "stdio.h"

#include "dos.h"

#include "stdlib.h"

#include "conio.h"

#define SEC 3

#define NULL 0

/*定义结构体*/

typedef struct PCB

{

int PID;

int UID;

struct PCB * next;

}PCB;

PCB *really , *excute , *wait;

/*create queue header */

/*queue operation 入队*/

int enqueue(PCB *head , PCB *node)

{

PCB *p;

p = head;

if(p -> next == NULL)

{

head -> next = node;

return 1;

}

while(p)

{

if(p -> next == NULL)

{

p -> next = node;

return 1;

}

else p = p -> next;

}

}/*enquue*/

/*dequeue 出队列 */

PCB * dequeue(PCB *head)

{

PCB *p;

p = head;

if(p -> next == NULL)

{

return NULL;

}

else

{

p = p -> next;

head -> next = p -> next;

p -> next = NULL;

return p;

}

/*head to next*/

}/*dequeue*/

/*PCB operate*/

/*新建进程*/

int create()

{

PCB *p;

p = (PCB*)malloc(sizeof(PCB));

p -> next = NULL;

printf("input PID and UID to a new processn"

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值