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

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

?? process.txt

?? 匯編編程藝術
?? TXT
?? 第 1 頁 / 共 2 頁
字號:
Process Manager Routines
------------------------

The UCR Standard Library Process package provides a simple preemptive
multitasking package for 8086 assembly language programmers.  It also
provides a coroutine package and support for semaphores.

First,  *AND THIS IS VERY IMPORTANT*, this package only supports the
8086, 8088, 80188, 80186, and 80286 processors operating in real mode.
You will need to make some minor modifications to the process package if
you wish to support the 32-bit x86 processors.  The current process manager
only saves 16-bit registers, not the 32-bit registers of the 80386 and later.
You will, however, find it a relatively minor task to go in and modify this
code to support the 386 and later processors.  We will probably add support
for these processors at a later date when time allows.

Second, *THIS IS ALSO VERY IMPORTANT*, keep in mind that DOS, BIOS, and many
of the routines in the standard library ARE NOT REENTRANT. Two processes
executing at the (apparent) same time cannot both be executing DOS, BIOS, or
the same standard library routines.  It is unlikely that DOS or BIOS will
ever be made reentrant, and you shouldn't ever expect the standard library
to be made reentrant (far too much work).  The standard library provides
semaphore support through which you can control access to critical resources
including DOS, BIOS, and the UCR Standard Library.  If you are unfamiliar
with terms like reentrancy, semaphores, synchronization, and deadlock, you
should probably pick up a good text on operating systems and familiarize
yourself with these terms before attempting to use this package.

This process package provides three facilities to your assembly language
programs: A preemptive multitasking process manager, coroutine support, and
semaphore support.  There are six routines associated with the preemptive
multitasking system: PRCSINIT, PRCSQUIT, FORK, KILL, DIE, and YIELD.  There
are three routines associated with the coroutines package: COINIT, COCALL,
and COCALLL (though you'll rarely refer to COCALLL directly).  Finally, there
are two routines to support semaphores: WAITSEMAPH and RLSSEMAPH.

The PRCSINIT and PRCSQUIT routines initialize and deinitialize the interrupt
system for the multitasking system.  You must call PRCSINIT prior to
executing any of the preemptive multitasking routines or any of the semaphore
routines (the semaphore routines make sense only in the context of preemptive
multitasking).  This initializes various internal variables and patches the
INT 8 interrupt vector (timer interrupt) to point at an internal routine
in the process manager.  You must call PRCSQUIT when you are done with the
preemptive multitasking system; certainly you must call it before your
program terminates *FOR ANY REASON*.  If you do not call PRCSQUIT, the system
will probably crash shortly after you try anything else after returning to
DOS since the timer interrupt will still be calling the routine left in
memory when your program terminates.

The process manager patches into the 1/18th second clock on the PC.  There-
fore, the system will automatically perform an context switch every 55ms
or so.  If your application reprograms the timer chip, this may produce
unexpected results.  This may be particularly bothersome if you are running
a TSR which plays with the timer chip.  Absolutely no attempt was made to
make this code robust enough to work in all cases with other code which
ties into the timer interrupt.  Most well-written code will work fine, but
there are not guarantees.

The FORK routine lets you spawn a new process.  For each call to FORK your
code makes, the FORK routine returns twice- once as the parent process and
once as the child process.  FORK returns process ID information in the AX
and BX registers so that the code immediately following the FORK can figure
out if it's the parent or child process.  FORK provides the basic (and only!)
mechanism for starting a second process.

The KILL and DIE routines let you terminate a process.  KILL lets one process
terminate some other process (generally a child process).  DIE lets a
process terminate itself.

The YIELD routine gives up the current process' time slice and lets some other
process take over.

The semaphore routines, WaitSemaph and RlsSemaph, let you wait on a semaphore
or signal that semaphore, respectively.  The PROCESS.A and PROCESS.A6
include files contain the definition of a semaphore type, it is

		semaphore	struc
		SemaCnt		dw	1
		smaphrLst	dd	?
		endsmaphrlst	dd	?
		semaphore	ends

The only field you should ever play around with is the SemaCnt field.  This
value is the number of processes which are allowed to be in the critical
region controlled by the semaphore at one time.  For most mutual exclusion
problems, this value should always be one.  Do not modify this value once
the program starts running.  The process package increments and decrements
this number to keep track of the number of processes waiting to use a
resource.  If you want to allow two processes to share a resource at the
same time, you should declare your semaphore variable as follows:

		MySemaPh	semaphore	<2>

You execute the WaitSemaPh routine to see if a semaphore is currently busy.
When you get back from the WaitSemaPh call, the resource protected by the
semaphore is exclusively yours until you execute the RlsSemaPh routine.
Note that when you call the WaitSemaPh routine, the specified resource may
already be in use, in which case your process will be suspended until the
resource is freed (and anyone waiting in line ahead of you has had their
shot at the resource).  If you do not call the RlsSemaPh routine to free
the semaphore, any other process waiting on that resource will wait
indefinitely.  Also note that if you call WaitSemaPh twice on a semaphore
without releasing it inbetween, your process and any other process which
waits on that resource will deadlock.

While semaphores solve a large number of synchronization and mutual exclusion
problems, their primary use in the UCR Standard Library is to prevent re-
entrancy problems in DOS, BIOS, and the Standard Library itself.  For example,
if you have two processes which print values to the display, attempting to
run both processes concurrently will crash the system if they both attempt
to print at the same time (since this will cause DOS to be reentered).  A
simple solution is to use a DOS semaphore as follows:

In the data segment:

DOS		semaphore	{}

In Process 1:

		lesi	DOS
		WaitSemaPh
		print
		db	"Printed from process #1.",cr,lf,0
		lesi	DOS
		RlsSemaPh

In Process 2:

		lesi	DOS
		WaitSemaPh
		print
		db	"Printed from process #2.",cr,lf,0
		lesi	DOS
		RlsSemaPh

Semaphore guarantee mutual exclusion between the WaitSemaPh and RlsSemaPh
calls (for a particular semaphore variable, DOS in this case).  Hence, once
process #1 enters its *CRITICAL REGION* by executing the WaitSemaPh call,
any attempt by process two to enter its critical region will cause process
two to suspend execution until process one executes the RlsSemaPh routine.

Coroutines provide "simulated" multitasking where the processes themselves
determine when to perform a context switch.  This is quite similar to the
"cooperative multitasking" systems provided by Apple, Microsoft, and others
("cooperative multitasking" is a hyped up term to hide the fact that their
systems provide only multiprogramming, not multitasking).  There are many
advantages and disadvantages to coroutines vs. multitasking.  First of all,
reentrancy problems do not exist in a system using coroutines.  Since you
control when one process switches to another, you can make sure that such
context switches do not occur in critical regions.  Another advantage to
coroutines is that the processes themselves can determine which other process
gets the next access to the CPU.  Finally, when a coroutine is executing,
it gets full access to the CPU to handle a time-critical operation without
fear of being preempted.  On the other hand, poorly designed coroutines
provide a very crude approximation to multitasking and may actually hurt
the overall performance of the system.

The UCR Standard Library provides three routines to support coroutines:
COINIT, COCALL, and COCALLL.  Generally, you'll only see COINIT and COCALL
in a program, the standard library automatically generates COCALLL calls
for certain types of COCALL statements.  The COINIT routine initializes the
coroutine package and creates a process control block (PCB) for the currently
active routine.  COCALL switches context to some other process.  When one
process COCALLs another and that second process COCALLs the first, the first
process continues execution immediately after the first COCALL instruction
(so it behaves more like a return than a call).  In general, you should not
think of COCALL as a "call" but rather as a "switch to some other process."

You may have coroutines and multitasking active at the same time, but you
should not make a COCALL to a process which is being time-sliced by the
multitasking system.  I won't guarantee that this *won't* work, but it
seems sufficiently weird that something is bound to go wrong.

For those who are interested, the coroutine and multitasking packages
maintain the state of a process in a process control block (PCB) which
is the following structure:



		pcb		struc
		NextProc	dd	?
		regsp		dw	?
		regss		dw	?
		regip		dw	?
		regcs		dw	?

		regax		dw	?
		regbx		dw	?
		regcx		dw	?
		regdx		dw	?
		regsi		dw	?
		regdi		dw	?
		regbp		dw	?
		regds		dw	?
		reges		dw	?
		regflags	dw	?
		PrcsID		dw	?
		StartingTime	dd	?
		StartingDate	dd	?
		CPUTime		dd	?
		pcb		ends

As mentioned earlier, this code does not maintain the full state of the
80386 and later processors since it only saves the 16-bit register set.
If you like, you can easily change the definition of the PCB, and all the
code in the PROCESS.ASM file which refers to the PCB, and support full
32-bit operation.  As usual, you should rarely, if ever, play around with
the internal fields of a PCB.  That is for the process manager to do and you
could mess things up pretty back if you're not careful.

Routine: prcsinit
-----------------

Category:             Processes

Registers on entry:   None

Registers on return:  None

Flags affected:       None

Example of Usage:

			prcsinit


Description:

Prcsinit initializes the process manager.  Note that if you make a call to
the process manager, you *MUST* make a call to prcsquit before your program
quits.  Failure to do so will crash the system in short order.  Note that
you must even handle the case where the user types control-C or encounters
a critical error and aborts back to DOS.

This routine patches into the timer interrupt vector (INT 08) and may not
work properly with code in the system which is also messing around with the
timer interrupt.

Include:	stdlib.a or process.a

Routine: prcsquit
-----------------

Category:             Processes

Registers on entry:   None

Registers on return:  None

Flags affected:       None

Example of Usage:

			prcsquit


Description:

Prcsquit deinitializes the process manager.  It detaches the timer interrupt
from the internal routine and performs various other clean up chores.  You
must call this routine before your program terminates if you've called
prcsinit somewhere in your program.

Note that you cannot call prcsquit twice in a row, although you can call
the prcsinit/prcsquit combinations as many times as you like in your code.

Include:	stdlib.a or process.a

Routine: fork
-------------

Category:             Processes

Registers on entry:   	ES:DI-	Points at a PCB to hold the process info
				for the new process.  The regss and regsp
				fields of this PCB must be initialized to
				the top of a new stack for the new process.

Registers on return:  	AX-	<Parent process> Returned containing zero.
				<Child  process> Child process ID.

			BX-     <Parent process> Child's process ID.
				<Child  process> Returned containing zero.

Flags affected:       	None

Example of Usage:

ChildPCB		pcb	{0, offset endstk, seg endstk}
			 .
			 .
			 .

			lesi	ChildPCB
			fork
			cmp	ax, 0
			jne	DoChildProcess
			<Parent process continues here>
			 .
			 .
			 .
ChildsStack		db	1024 dup (?)
EndStk			dw	0

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费成人在线播放| 国产传媒一区在线| 国产精品自在在线| 欧美性猛交xxxxxx富婆| 色综合久久久久网| 91精品一区二区三区久久久久久 | 午夜精品久久久久| 国内精品写真在线观看| 精品视频全国免费看| 国产精品无圣光一区二区| 日本欧美韩国一区三区| 一本到一区二区三区| 久久只精品国产| 天堂一区二区在线| 欧美亚日韩国产aⅴ精品中极品| 国产区在线观看成人精品 | 欧美国产日韩a欧美在线观看| 亚洲精品国产a| 国产91高潮流白浆在线麻豆| 在线播放91灌醉迷j高跟美女 | 国内精品国产成人国产三级粉色 | 日韩午夜中文字幕| 亚洲激情成人在线| 99精品国产一区二区三区不卡| 精品裸体舞一区二区三区| 亚洲高清一区二区三区| 91在线观看污| 中文字幕在线一区| 成人爽a毛片一区二区免费| 久久亚洲捆绑美女| 国产精品一色哟哟哟| 亚洲精品一区二区三区99| 久久精品72免费观看| 日韩三级在线免费观看| 看电视剧不卡顿的网站| 日韩午夜激情av| 九九精品视频在线看| 精品裸体舞一区二区三区| 久久精品国产**网站演员| 精品国产一区二区三区久久久蜜月| 日韩在线观看一区二区| 欧美精品久久久久久久多人混战 | 精品福利一区二区三区免费视频| 图片区小说区国产精品视频| 777午夜精品免费视频| 日韩在线一区二区| 日韩精品中午字幕| 狠狠色2019综合网| 中文字幕乱码亚洲精品一区| 成人av网站免费| 一区二区三区日韩在线观看| 欧美系列一区二区| 麻豆精品久久精品色综合| 久久人人97超碰com| 成人国产精品免费网站| 一区二区三区精品视频| 91精品国产91久久综合桃花 | 欧美私模裸体表演在线观看| 五月天一区二区三区| 日韩欧美中文字幕公布| 丰满少妇久久久久久久 | 久久婷婷久久一区二区三区| av电影在线观看一区| 亚洲在线观看免费视频| 日韩一级二级三级| aaa亚洲精品| 日本不卡视频在线| 国产欧美日韩综合精品一区二区| 91老师片黄在线观看| 蜜桃视频一区二区| 亚洲欧洲三级电影| 欧美一区二区三区人| 成人一区二区三区视频在线观看| 亚洲一二三四区不卡| 国产亚洲欧美色| 欧美日韩一区二区三区在线看| 乱中年女人伦av一区二区| 亚洲欧洲日韩在线| 欧美成人一区二区三区片免费 | 激情综合一区二区三区| 亚洲精品免费在线观看| 亚洲1区2区3区4区| 久久亚洲精品国产精品紫薇| 成人一道本在线| 精品国产sm最大网站| 成人免费视频播放| 日本亚洲视频在线| |精品福利一区二区三区| 日韩亚洲欧美中文三级| 色网综合在线观看| 国产一区 二区| 亚洲成av人片| 综合电影一区二区三区 | 日韩一区二区三| 色综合久久久久久久久| 国产精品影视天天线| 日本中文字幕一区二区视频| 亚洲精品高清在线观看| 欧美国产激情二区三区| 日韩欧美国产一区二区三区 | 国产成人免费视频一区| 男女男精品视频| 亚洲第一电影网| 亚洲美女电影在线| 欧美激情在线看| 久久先锋资源网| 日韩精品一区在线观看| 欧美另类z0zxhd电影| 在线看不卡av| 日本韩国精品一区二区在线观看| 成人一区二区三区视频在线观看| 国产精品影视在线| 美脚の诱脚舐め脚责91| 日韩电影在线免费| 夜色激情一区二区| 亚洲人一二三区| 亚洲欧美一区二区三区国产精品| 国产欧美日韩视频在线观看| 视频一区视频二区中文字幕| 亚洲免费观看高清完整版在线观看 | 亚洲素人一区二区| 国产农村妇女毛片精品久久麻豆| 欧美日韩精品一区二区| 91官网在线观看| 欧美亚洲国产bt| 91福利社在线观看| 欧美日韩亚洲综合一区| 欧美三级视频在线| 91精品国产91综合久久蜜臀| 日韩欧美在线影院| 欧美精品一区二区三区高清aⅴ| 精品国产伦理网| 福利一区福利二区| 国模大尺度一区二区三区| 国产一区在线不卡| 成人免费视频一区| 一本久久a久久免费精品不卡| 色综合激情五月| 欧美日韩一卡二卡| 日韩欧美精品三级| 中文幕一区二区三区久久蜜桃| 中文字幕乱码久久午夜不卡 | 国产精品77777竹菊影视小说| 大陆成人av片| 欧美在线999| 欧美一区二区三区成人| 精品国产3级a| 亚洲女厕所小便bbb| 日韩精品成人一区二区三区| 国内精品久久久久影院色| 99视频一区二区三区| 91精品中文字幕一区二区三区| 久久婷婷久久一区二区三区| 亚洲欧美日本在线| 麻豆成人久久精品二区三区小说| 成人av免费在线| 日韩三级中文字幕| 中文字幕在线观看不卡视频| 91浏览器在线视频| 国产日产欧产精品推荐色| 国产精品女主播在线观看| 亚洲午夜影视影院在线观看| 免费观看在线色综合| 粉嫩一区二区三区在线看| 91国偷自产一区二区开放时间 | 日本中文字幕一区二区视频| 国产黄色精品视频| 欧美亚洲另类激情小说| 欧美精品一区二区三区高清aⅴ| 亚洲特级片在线| 激情综合色综合久久| 在线一区二区视频| 国产欧美一区视频| 日韩av电影一区| 欧美日韩精品电影| 亚洲色图欧洲色图婷婷| 亚洲国产精品欧美一二99| 国产乱人伦偷精品视频免下载| 色噜噜狠狠成人网p站| 久久新电视剧免费观看| 天天综合网天天综合色| 91一区二区在线观看| 精品久久一区二区| 丝袜亚洲精品中文字幕一区| av在线一区二区三区| 国产三级精品在线| 久久草av在线| 欧美一级片在线| 午夜婷婷国产麻豆精品| 色伊人久久综合中文字幕| 中文字幕 久热精品 视频在线| 九九久久精品视频| 日韩欧美中文一区二区| 日韩福利视频导航| 欧美日本国产一区| 一区二区三区高清不卡| 一本一道波多野结衣一区二区| 中文字幕亚洲区| 波多野结衣在线aⅴ中文字幕不卡| 精品国产乱码久久久久久免费 |