亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? slp.c

?? UNIX v6 源代碼
?? C
字號:
#/* */#include "../param.h"#include "../user.h"#include "../proc.h"#include "../text.h"#include "../systm.h"#include "../file.h"#include "../inode.h"#include "../buf.h"/* * Give up the processor till a wakeup occurs * on chan, at which time the process * enters the scheduling queue at priority pri. * The most important effect of pri is that when * pri<0 a signal cannot disturb the sleep; * if pri>=0 signals will be processed. * Callers of this routine must be prepared for * premature return, and check that the reason for * sleeping has gone away. */sleep(chan, pri){	register *rp, s;	s = PS->integ;	rp = u.u_procp;	if(pri >= 0) {		if(issig())			goto psig;		spl6();		rp->p_wchan = chan;		rp->p_stat = SWAIT;		rp->p_pri = pri;		spl0();		if(runin != 0) {			runin = 0;			wakeup(&runin);		}		swtch();		if(issig())			goto psig;	} else {		spl6();		rp->p_wchan = chan;		rp->p_stat = SSLEEP;		rp->p_pri = pri;		spl0();		swtch();	}	PS->integ = s;	return;	/*	 * If priority was low (>=0) and	 * there has been a signal,	 * execute non-local goto to	 * the qsav location.	 * (see trap1/trap.c)	 */psig:	aretu(u.u_qsav);}/* * Wake up all processes sleeping on chan. */wakeup(chan){	register struct proc *p;	register c, i;	c = chan;	p = &proc[0];	i = NPROC;	do {		if(p->p_wchan == c) {			setrun(p);		}		p++;	} while(--i);}/* * Set the process running; * arrange for it to be swapped in if necessary. */setrun(p){	register struct proc *rp;	rp = p;	rp->p_wchan = 0;	rp->p_stat = SRUN;	if(rp->p_pri < curpri)		runrun++;	if(runout != 0 && (rp->p_flag&SLOAD) == 0) {		runout = 0;		wakeup(&runout);	}}/* * Set user priority. * The rescheduling flag (runrun) * is set if the priority is higher * than the currently running process. */setpri(up){	register *pp, p;	pp = up;	p = (pp->p_cpu & 0377)/16;	p =+ PUSER + pp->p_nice;	if(p > 127)		p = 127;	if(p > curpri)		runrun++;	pp->p_pri = p;}/* * The main loop of the scheduling (swapping) * process. * The basic idea is: *  see if anyone wants to be swapped in; *  swap out processes until there is room; *  swap him in; *  repeat. * Although it is not remarkably evident, the basic * synchronization here is on the runin flag, which is * slept on and is set once per second by the clock routine. * Core shuffling therefore takes place once per second. * * panic: swap error -- IO error while swapping. *	this is the one panic that should be *	handled in a less drastic way. Its *	very hard. */sched(){	struct proc *p1;	register struct proc *rp;	register a, n;	/*	 * find user to swap in	 * of users ready, select one out longest	 */	goto loop;sloop:	runin++;	sleep(&runin, PSWP);loop:	spl6();	n = -1;	for(rp = &proc[0]; rp < &proc[NPROC]; rp++)	if(rp->p_stat==SRUN && (rp->p_flag&SLOAD)==0 &&	    rp->p_time > n) {		p1 = rp;		n = rp->p_time;	}	if(n == -1) {		runout++;		sleep(&runout, PSWP);		goto loop;	}	/*	 * see if there is core for that process	 */	spl0();	rp = p1;	a = rp->p_size;	if((rp=rp->p_textp) != NULL)		if(rp->x_ccount == 0)			a =+ rp->x_size;	if((a=malloc(coremap, a)) != NULL)		goto found2;	/*	 * none found,	 * look around for easy core	 */	spl6();	for(rp = &proc[0]; rp < &proc[NPROC]; rp++)	if((rp->p_flag&(SSYS|SLOCK|SLOAD))==SLOAD &&	    (rp->p_stat == SWAIT || rp->p_stat==SSTOP))		goto found1;	/*	 * no easy core,	 * if this process is deserving,	 * look around for	 * oldest process in core	 */	if(n < 3)		goto sloop;	n = -1;	for(rp = &proc[0]; rp < &proc[NPROC]; rp++)	if((rp->p_flag&(SSYS|SLOCK|SLOAD))==SLOAD &&	   (rp->p_stat==SRUN || rp->p_stat==SSLEEP) &&	    rp->p_time > n) {		p1 = rp;		n = rp->p_time;	}	if(n < 2)		goto sloop;	rp = p1;	/*	 * swap user out	 */found1:	spl0();	rp->p_flag =& ~SLOAD;	xswap(rp, 1, 0);	goto loop;	/*	 * swap user in	 */found2:	if((rp=p1->p_textp) != NULL) {		if(rp->x_ccount == 0) {			if(swap(rp->x_daddr, a, rp->x_size, B_READ))				goto swaper;			rp->x_caddr = a;			a =+ rp->x_size;		}		rp->x_ccount++;	}	rp = p1;	if(swap(rp->p_addr, a, rp->p_size, B_READ))		goto swaper;	mfree(swapmap, (rp->p_size+7)/8, rp->p_addr);	rp->p_addr = a;	rp->p_flag =| SLOAD;	rp->p_time = 0;	goto loop;swaper:	panic("swap error");}/* * This routine is called to reschedule the CPU. * if the calling process is not in RUN state, * arrangements for it to restart must have * been made elsewhere, usually by calling via sleep. */swtch(){	static struct proc *p;	register i, n;	register struct proc *rp;	if(p == NULL)		p = &proc[0];	/*	 * Remember stack of caller	 */	savu(u.u_rsav);	/*	 * Switch to scheduler's stack	 */	retu(proc[0].p_addr);loop:	runrun = 0;	rp = p;	p = NULL;	n = 128;	/*	 * Search for highest-priority runnable process	 */	i = NPROC;	do {		rp++;		if(rp >= &proc[NPROC])			rp = &proc[0];		if(rp->p_stat==SRUN && (rp->p_flag&SLOAD)!=0) {			if(rp->p_pri < n) {				p = rp;				n = rp->p_pri;			}		}	} while(--i);	/*	 * If no process is runnable, idle.	 */	if(p == NULL) {		p = rp;		idle();		goto loop;	}	rp = p;	curpri = n;	/*	 * Switch to stack of the new process and set up	 * his segmentation registers.	 */	retu(rp->p_addr);	sureg();	/*	 * If the new process paused because it was	 * swapped out, set the stack level to the last call	 * to savu(u_ssav).  This means that the return	 * which is executed immediately after the call to aretu	 * actually returns from the last routine which did	 * the savu.	 *	 * You are not expected to understand this.	 */	if(rp->p_flag&SSWAP) {		rp->p_flag =& ~SSWAP;		aretu(u.u_ssav);	}	/*	 * The value returned here has many subtle implications.	 * See the newproc comments.	 */	return(1);}/* * Create a new process-- the internal version of * sys fork. * It returns 1 in the new process. * How this happens is rather hard to understand. * The essential fact is that the new process is created * in such a way that appears to have started executing * in the same call to newproc as the parent; * but in fact the code that runs is that of swtch. * The subtle implication of the returned value of swtch * (see above) is that this is the value that newproc's * caller in the new process sees. */newproc(){	int a1, a2;	struct proc *p, *up;	register struct proc *rpp;	register *rip, n;	p = NULL;	/*	 * First, just locate a slot for a process	 * and copy the useful info from this process into it.	 * The panic "cannot happen" because fork has already	 * checked for the existence of a slot.	 */retry:	mpid++;	if(mpid < 0) {		mpid = 0;		goto retry;	}	for(rpp = &proc[0]; rpp < &proc[NPROC]; rpp++) {		if(rpp->p_stat == NULL && p==NULL)			p = rpp;		if (rpp->p_pid==mpid)			goto retry;	}	if ((rpp = p)==NULL)		panic("no procs");	/*	 * make proc entry for new proc	 */	rip = u.u_procp;	up = rip;	rpp->p_stat = SRUN;	rpp->p_flag = SLOAD;	rpp->p_uid = rip->p_uid;	rpp->p_ttyp = rip->p_ttyp;	rpp->p_nice = rip->p_nice;	rpp->p_textp = rip->p_textp;	rpp->p_pid = mpid;	rpp->p_ppid = rip->p_pid;	rpp->p_time = 0;	/*	 * make duplicate entries	 * where needed	 */	for(rip = &u.u_ofile[0]; rip < &u.u_ofile[NOFILE];)		if((rpp = *rip++) != NULL)			rpp->f_count++;	if((rpp=up->p_textp) != NULL) {		rpp->x_count++;		rpp->x_ccount++;	}	u.u_cdir->i_count++;	/*	 * Partially simulate the environment	 * of the new process so that when it is actually	 * created (by copying) it will look right.	 */	savu(u.u_rsav);	rpp = p;	u.u_procp = rpp;	rip = up;	n = rip->p_size;	a1 = rip->p_addr;	rpp->p_size = n;	a2 = malloc(coremap, n);	/*	 * If there is not enough core for the	 * new process, swap out the current process to generate the	 * copy.	 */	if(a2 == NULL) {		rip->p_stat = SIDL;		rpp->p_addr = a1;		savu(u.u_ssav);		xswap(rpp, 0, 0);		rpp->p_flag =| SSWAP;		rip->p_stat = SRUN;	} else {	/*	 * There is core, so just copy.	 */		rpp->p_addr = a2;		while(n--)			copyseg(a1++, a2++);	}	u.u_procp = rip;	return(0);}/* * Change the size of the data+stack regions of the process. * If the size is shrinking, it's easy-- just release the extra core. * If it's growing, and there is core, just allocate it * and copy the image, taking care to reset registers to account * for the fact that the system's stack has moved. * If there is no core, arrange for the process to be swapped * out after adjusting the size requirement-- when it comes * in, enough core will be allocated. * Because of the ssave and SSWAP flags, control will * resume after the swap in swtch, which executes the return * from this stack level. * * After the expansion, the caller will take care of copying * the user's stack towards or away from the data area. */expand(newsize){	int i, n;	register *p, a1, a2;	p = u.u_procp;	n = p->p_size;	p->p_size = newsize;	a1 = p->p_addr;	if(n >= newsize) {		mfree(coremap, n-newsize, a1+newsize);		return;	}	savu(u.u_rsav);	a2 = malloc(coremap, newsize);	if(a2 == NULL) {		savu(u.u_ssav);		xswap(p, 1, n);		p->p_flag =| SSWAP;		swtch();		/* no return */	}	p->p_addr = a2;	for(i=0; i<n; i++)		copyseg(a1+i, a2++);	mfree(coremap, n, a1);	retu(p->p_addr);	sureg();}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人福利电影精品一区二区在线观看| 国产精品拍天天在线| 亚洲国产精品精华液网站| 91网上在线视频| 亚洲欧美日本在线| 91国偷自产一区二区三区观看| 中文字幕一区二区三区四区不卡 | 一区二区三区四区国产精品| 成人免费的视频| 亚洲欧美一区二区三区久本道91 | 不卡欧美aaaaa| 亚洲精品网站在线观看| 在线观看国产91| 蜜桃av一区二区三区电影| 日韩精品一区国产麻豆| 国产高清亚洲一区| 亚洲色欲色欲www| 欧美日韩国产电影| 精品在线观看视频| 自拍偷拍国产亚洲| 欧美成人vps| 盗摄精品av一区二区三区| 亚洲影视在线观看| 欧美色爱综合网| 欧美另类z0zxhd电影| 欧美日韩一区二区三区免费看| 日日骚欧美日韩| 久久综合久久久久88| 99久久久久久| 久久国产欧美日韩精品| 亚洲视频一区二区免费在线观看| 日韩一级大片在线| 91免费在线视频观看| 捆绑变态av一区二区三区| 亚洲天堂2016| 国产午夜精品理论片a级大结局 | av一二三不卡影片| 日本女人一区二区三区| 中文字幕亚洲电影| 欧美精品一区二区三区很污很色的| 91免费版pro下载短视频| 久久99精品久久只有精品| 一区二区三区小说| 国产亚洲欧美激情| 制服丝袜激情欧洲亚洲| 91欧美一区二区| 国v精品久久久网| 免费一级片91| 亚洲成人动漫一区| 亚洲欧洲精品天堂一级| 久久综合国产精品| 精品久久人人做人人爱| 欧美嫩在线观看| 91国产免费观看| 99热这里都是精品| 国产精品综合二区| 另类成人小视频在线| 偷拍一区二区三区| 亚洲成精国产精品女| 亚洲精品久久久蜜桃| 久久亚洲精精品中文字幕早川悠里| 欧美日韩日日夜夜| 欧美视频一区二区在线观看| 色婷婷av一区二区三区之一色屋| 国产成人精品免费在线| 久久精品国产亚洲a| 蜜臀av性久久久久蜜臀aⅴ| 日韩成人一级片| 日产欧产美韩系列久久99| 午夜电影网亚洲视频| 亚洲成人久久影院| 天天射综合影视| 日韩精品视频网站| 日本中文字幕不卡| 日本不卡一区二区三区| 国产精品综合二区| 精品写真视频在线观看| 国产一区二区美女诱惑| 韩国女主播一区| 韩国女主播成人在线观看| 国产精品 日产精品 欧美精品| 国产精品99久久久| 国产高清成人在线| 成人午夜视频网站| 99国产欧美久久久精品| 99国产精品99久久久久久| av中文字幕亚洲| 色美美综合视频| 欧美综合天天夜夜久久| 欧美精品777| 精品国产一区二区三区av性色| 久久一区二区视频| 欧美国产禁国产网站cc| 成人欧美一区二区三区黑人麻豆| 亚洲女与黑人做爰| 日韩二区在线观看| 国产伦理精品不卡| 91一区二区在线| 欧美高清视频一二三区 | 香港成人在线视频| 麻豆成人久久精品二区三区红| 另类小说视频一区二区| 国产1区2区3区精品美女| 一本到不卡免费一区二区| 欧美日韩国产bt| 久久久久国色av免费看影院| 亚洲日本韩国一区| 麻豆91免费看| 99久精品国产| 日韩一卡二卡三卡四卡| 亚洲国产精品传媒在线观看| 亚洲国产精品视频| 国产精品亚洲视频| 欧美日韩免费不卡视频一区二区三区| 欧美高清视频一二三区| 亚洲国产电影在线观看| 日日夜夜精品视频天天综合网| 粉嫩嫩av羞羞动漫久久久| 在线精品视频免费播放| 久久久欧美精品sm网站| 亚洲一级在线观看| 国产suv精品一区二区6| 欧美高清精品3d| 国产精品免费免费| 蜜桃av一区二区三区| 91视频在线看| 久久精品一区蜜桃臀影院| 亚洲国产成人高清精品| eeuss国产一区二区三区| 日韩午夜在线影院| 亚洲国产精品视频| 99视频超级精品| 久久久www成人免费无遮挡大片| 一区二区三区精品视频| 国产.精品.日韩.另类.中文.在线.播放 | 欧美久久久一区| 国产精品久线观看视频| 精品一区二区三区久久| 91福利在线免费观看| 日本一区二区三区国色天香| 日本sm残虐另类| 欧美美女一区二区三区| 亚洲欧美激情视频在线观看一区二区三区| 久久99国内精品| 欧美一级黄色录像| 亚洲自拍偷拍图区| 99久久精品国产麻豆演员表| 久久综合色8888| 久久er精品视频| 日韩欧美一级片| 丝袜a∨在线一区二区三区不卡| 欧美亚洲综合在线| 亚洲伊人色欲综合网| 色吧成人激情小说| 最好看的中文字幕久久| 不卡的av网站| 国产精品初高中害羞小美女文| 国产高清不卡一区二区| 国产午夜精品福利| 国产精品18久久久| 久久精品欧美一区二区三区不卡| 麻豆国产一区二区| 日韩免费电影网站| 激情综合色播激情啊| 精品国产亚洲在线| 精品无码三级在线观看视频 | 国产日韩欧美麻豆| 国产美女精品在线| 2023国产精品视频| 国产精品一二三四五| 国产欧美精品一区二区色综合 | 色又黄又爽网站www久久| 亚洲欧洲日产国码二区| 99re亚洲国产精品| 亚洲美女淫视频| 欧美理论电影在线| 久久国产人妖系列| 国产清纯美女被跳蛋高潮一区二区久久w| 国产在线麻豆精品观看| 欧美激情自拍偷拍| 91美女福利视频| 夜夜嗨av一区二区三区中文字幕 | 欧美性猛交xxxx黑人交| 天天亚洲美女在线视频| 日韩精品在线一区| 国产超碰在线一区| 亚洲欧美日韩在线| 欧美一区欧美二区| 韩国v欧美v亚洲v日本v| 中文字幕视频一区| 777精品伊人久久久久大香线蕉| 精品一区二区三区视频| 国产精品理论片| 欧美日韩国产美| 国产suv精品一区二区三区| 亚洲免费成人av| 精品久久一区二区| 色老头久久综合| 青青草伊人久久| 国产欧美日韩三级|