• No results found

SCHEDULING IN CONCURRENT PASCAL * F. B. Schneider A. J. Bernstein Department of Computer Science S.U.N.Y. at Stony Brook Stony Brook, New York, 11794

N/A
N/A
Protected

Academic year: 2021

Share "SCHEDULING IN CONCURRENT PASCAL * F. B. Schneider A. J. Bernstein Department of Computer Science S.U.N.Y. at Stony Brook Stony Brook, New York, 11794"

Copied!
6
0
0

Loading.... (view fulltext now)

Full text

(1)

S C H E D U L I N G IN C O N C U R R E N T P A S C A L * F. B. S c h n e i d e r A. J. B e r n s t e i n D e p a r t m e n t of C o m p u t e r S c i e n c e S . U . N . Y . at S t o n y B r o o k S t o n y B r o o k , N e w York, 1 1 7 9 4 I n t r o d u c t i o n T h e m o n i t o r c o n s t r u c t [H74] [B75] and the p r o g r a m m i n g l a n - g u a g e C o n c u r r e n t P a s c a l [B75] h a v e p r o v i d e d a b a s i s for r e s e a r c h i n t o o p e r a t i n g systems. B a s e d on the e x p e r i e n c e s g a i n e d by the u s e o f C o n c u r r e n t P a s c a l in the c o n s t r u c t i o n of o p e r a t i n g s y s t e m s

[B76] [G77] t h e r e has b e e n s o m e d i s c u s s i o n a b o u t the m o n i t o r im- p l e m e n t a t i o n s p r o p o s e d b y B r i n c h H a n s e n [B75] a n d H o a r e [H74]. F o r e x a m p l e , t h e (non) p r o b l e m of n e s t e d m o n i t o r c a l l s h a s re- c e i v e d c o n s i d e r a b l e a t t e n t i o n [L77] [H77] [B78] [W78]. In a d d i - tion, t h e l a c k of f a c i l i t i e s for d y n a m i c r e s o u r c e m a n a g e m e n t in C o n c u r r e n t P a s c a l has i n s p i r e d r e s e a r c h p r o p o s a l s w h i c h e x t e n d t h e l a n g u a g e to s o l v e t h o s e p r o b l e m s [$77] [K77] [A78]. It is u n f o r t u n a t e t h a t m u c h of t h i s r e s e a r c h c u l m i n a t e s in n e w m o n i t o r - l i k e o b j e c t s w h i c h c a n o n l y be u s e d to s o l v e p a r t i c u l a r p r o b l e m s . A s p o i n t e d o u t b y P a r n a s [P78] t h i s s e e m s to i n d i c a t e t h a t m o r e p r i m i t i v e c o n s t r u c t s f r o m w h i c h v a r i o u s m o n i t o r - l i k e o b j e c t s m a y be b u i l t , are r e q u i r e d . In t h i s p a p e r s u c h a c o n s t r u c t is in- t r o d u c e d a n d its a p p l i c a b i l i t y in m o n i t o r s u s e d to c o n s t r u c t s y s t e m s w h i c h i m p o s e a s c h e d u l i n g d i s c i p l i n e o n a s h a r e d r e s o u r c e (e.g. disk) is s t u d i e d . T h e S c h e d u l i n g S c e n a r i o C o n s i d e r a s y s t e m in w h i c h a n u m b e r o f c o n c u r r e n t l y e x e c u t i n g p r o c e s s e s a c c e s s some s h a r e d r e s o u r c e s u c h as a disk. D i s k h e a d s e e k t i m e s are u s u a l l y v e r y l o n g c o m p a r e d w i t h the a c t u a l d a t a t r a n s f e r t i m e a s s o c i a t e d w i t h a d i s k a c c e s s . C o n s e q u e n t l y , m o r e e f f i c i e n t d i s k u t i l i z a t i o n , as w e l l as i m p r o v e d a v e r a g e w a i t i n g t i m e f o r p r o c e s s e s a t t e m p t i n g to a c c e s s the d i s k , c a n be r e a l i z e d b y u s i n g a d i s k h e a d s c h e d u l i n g a l g o r i t h m s u c h as t h e one de- s c r i b e d in [H74]. In t h i s a l g o r i t h m r e q u e s t s a r e o r d e r e d so t h a t t h e d i s k h e a d s w e e p s a c r o s s t h e d i s k in o n e d i r e c t i o n , t h e n the ovther, a n a l o g o u s to the o p e r a t i o n of a n e l e v a t o r in a n o f f i c e b u i l d i n g . A n a c c e s s g r a p h [B72] for t h e i m p l e m e n t a t i o n of a s c h e d u l i n g a l g o r i t h m for a d i s k is i l l u s t r a t e d in F i g u r e i. In o r d e r to a c c e s s the d i s k it is r e q u i r e d t h a t a u s e r f i r s t c a l l t h e s c h e d u l - er, w h i c h m a y c a u s e the c a l l e r to b e s u s p e n d e d u n t i l a t i m e w h e n the d i s k t r a n s f e r c a n be p e r f o r m e d e f f i c i e n t l y . U p o n r e t u r n i n g T h i s r e s e a r c h w a s s u p p o r t e d in p a r t b y N S F g r a n t M C S 7 6 - 0 4 8 2 8 .

(2)

f r o m the s c h e d u l e r , the d i s k is c a l l e d to p e r f o r m the a c t u a l I/O o p e r a t i o n . L a s t l y , the s c h e d u l e r is c a l l e d to r e p o r t the c o m p l e - t i o n of the t r a n s f e r . T h i s s t r u c t u r e , h o w e v e r , is u n d e s i r a b l e s i n c e it r e v e a l s to h i g h e r l e v e l s of the s y s t e m (the u s e r m o d u l e s in t h i s case) the f u n c t i o n s of s c h e d u l i n g a n d d i s k I/O as s e p a r a t e e n t i t i e s o In a d d i t i o n , a u s e r c o u l d e a s i l y d e f e a t the s c h e d u l i n g a l g o r i t h m by n o t c a l l i n g t h e s c h e d u l e r p r i o r to a c c e s s i n g t h e disk. A m o r e d e s i r a b l e a r r a n g e m e n t w o u l d be to p r o v i d e a s i n g l e c a l l w h i c h i n v o k e d b o t h t h e s c h e d u l i n g and t r a n s f e r f u n c t i o n s , a n d r e t u r n e d to the h i g h e r l e v e l on c o m p l e t i o n . It w o u l d t h e n b e im- p o s s i b l e for a u s e r to d i r e c t l y a c c e s s the r e s o u r c e , s a v e t h r o u g h the " s c h e d u l e r " . A l t h o u g h F i g u r e 2 e x h i b i t s t h i s t y p e of s t r u c - t u r e it is u n a c c e p t a b l e b e c a u s e e n t r y to the s c h e d u l e r is p r e - v e n t e d if an I/O o p e r a t i o n is in p r o g r e s s (due to the m u t u a l ex- c l u s i o n a s s o c i a t e d w i t h t h a t m o n i t o r ) . T h u s no r e a l s c h e d u l i n g can t a k e p l a c e b e c a u s e p r o c e s s e s w o u l d be s u s p e n d e d at the en- t r a n c e to the s c h e d u l e r , i n s t e a d of i n s i d e it w h e r e an o r d e r i n g on t h e s u s p e n d e d p r o c e s s e s w o u l d be i m p o s e d b y s o m e p r i o r i t y w a i t m e c h a n i s m [H74]. T h e N e w C o n s t r u c t To s o l v e t h i s p r o b l e m , w e p r o p o s e a n e w m e c h a n i s m w h i c h c a n be u s e d in d e s i g n i n g a m o n i t o r . O r d i n a r i l y , p r o c e s s e s a t t e m p t i n g to e n t e r m o n i t o r p r o c e d u r e s w h i l e a n o t h e r p r o c e s s is a c t i v e w i t h - in t h e m o n i t o r a r e d e l a y e d b y m u t u a l e x c l u s i o n at m o n i t o r e n t r y . T h e o r d e r in w h i c h t h e s e p r o c e s s e s u l t i m a t e l y e n t e r is u n d e f i n e d . W e p r o p o s e the a d d i t i o n of a f a c i l i t y t h r o u g h w h i c h t h i s o r d e r c a n be e x p l i c i t l y c o n t r o l l e d . T h i s is a c c o m p l i s h e d by a s s o c i a t - ing w i t h e a c h e n t r y p r o c e d u r e an i n t e g e r v a l u e d f u n c t i o n c a l l e d a s c h e d u l i n g d i s c i p l i n e , w h i c h y i e l d s a p r i o r i t y . T h i s p r i o r i t y is u s e d t o o r d e r t h e p r o c e s s e s w a i t i n g to e n t e r t h e m o n i t o r . A s c h e d u l i n g d i s c i p l i n e is a s s o c i a t e d w i t h a p r o c e d u r e e n t r y by t h e u s e c l a u s e in the p r o c e d u r e h e a d i n g . T h e n a m e d s c h e d u l i n g d i s c i p l i n e is t h e n u s e d to c o m p u t e the p r i o r i t y of a p r o c e s s a t t e m p t i n g to e n t e r t h a t p r o c e d u r e . S c h e d u l i n g d i s c i p l i n e s a r e d e f i n e d as P A S C A L f u n c t i o n s , d e c l a r e d g l o b a l to all e n t r y p r o - c e d u r e s . T h e f u n c t i o n m a y r e f e r e n c e p e r m a n e n t m o n i t o r v a r i a b l e s , t h o u g h it m a y n o t a l t e r t h e i r v a l u e s . T h e f u n c t i o n ' s p a r a m e t e r l i s t p r o v i d e s a m e c h a n i s m for u s i n g m o n i t o r p r o c e d u r e e n t r y p a - r a m e t e r s in the p r i o r i t y c o m p u t a t i o n as well. C a l l b y v a l u e is i m p o s e d to e n s u r e t h a t the f u n c t i o n e x e c u t e s w i t h o u t s i d e - e f f e c t s .

(3)

is b l o c k e d at m u t u a l e x c l u s i o n . T h e s e p r o c e s s e s are t h e n o r d e r e d on an e n t r y q u e u e , w h i c h is a q u e u e a s s o c i a t e d w i t h the m o n i t o r c o n t a i n i n g e n t r i e s for p r o c e s s e s a r r a n g e d in a s c e n d i n g p r i o r i t y order° The p r o c e s s at the h e a d of the q u e u e is t h e n g r a n t e d e n t r a n c e . T h e e v a l u a t i o n of t h a t s c h e d u l i n g d i s c i p l i n e m a y o n l y be p e r - f o r m e d w h i l e t h e r e is no p r o c e s s a c t i v e l y e x e c u t i n g in the m o n i - tor, b e c a u s e p e r m a n e n t m o n i t o r v a r i a b l e s w i l l be r e f e r e n c e d . It m a y be t h a t a n u m b e r of p r o c e s s e s m u s t be a d d e d to the e n t r y q u e u e e a c h t i m e c o n t r o l is r e l i n q u i s h e d . T h i s is b e c a u s e the t i m e s p e n t at t h e s c h e d u l e d r e s o u r c e (e.g. disk) b y a p r o c e s s c a n be r e l a t i v e l y long, and for t h a t t i m e the m u t u a l e x c l u s i o n at the m o n i t o r w i l l be in e f f e c t due to t h e n e s t e d c a l l (as in F i g u r e 2). F i g u r e 3 i l l u s t r a t e s the u s e of t h i s f e a t u r e by i m p l e m e n t i n g t h e d i s k h e a d s c h e d u l i n g a l g o r i t h m d i s c u s s e d e a r l i e r . It s h o u l d be n o t e d t h a t it is not p o s s i b l e to w r i t e p a t h o - l o g i c a l s c h e d u l i n g d i s c i p l i n e s in w h i c h e a c h t i m e a p r o c e s s re- l i n q u i s h e s c o n t r o l of the m o n i t o r t h e r e l a t i v e o r d e r i n g of the p r o c e s s e s on the e n t r y q u e u e c h a n g e s d u e to the a l t e r e d v a l u e s of the p e r m a n e n t v a r i a b l e s . S u c h a c a p a b i l i t y d o e s n o t a p p e a r to h a v e a n y p r a c t i c a l a p p l i c a t i o n a n d w o u l d i n c u r a h i g h e x e c u t i o n o v e r h e a d for the c o n t e x t s w i t c h e s a s s o c i a t e d w i t h t h e r e p e a t e d e v a l u a t i o n o f t h e p r i o r i t y f u n c t i o n s . T h e c o n s t r u c t , as w e h a v e p r o p o s e d it, r e q u i r e s two c o n t e x t s w i t c h e s for e a c h p r o c e s s t h a t e n t e r s the m o n i t o r ; o n e f o r p r i o r i t y e v a l u a t i o n , and a s e c o n d a t m o n i t o r entry. In c e r t a i n s i t u a t i o n s e v e n t h i s m a y b e d e e m e d e x c e s s i v e o v e r h e a d . C o n c l u s i o n A g e n e r a l i z a t i o n of t h e m o n i t o r [H74] [B75] h a s b e e n p r e - s e n t e d w h i c h p e r m i t s a n a t u r a l s o l u t i o n to s c h e d u l i n g p r o b l e m s . The c o n s t r u c t is a n a l o g o u s to a p r i o r i t y w a i t m e c h a n i s m [H74] f o r m o n i t o r entry. P r e s e n t m o n i t o r i m p l e m e n t a - ~ n s u s u a l l y i m p o s e a f i r s t c o m e f i r s t s e r v e d d i s c i p l i n e o n m o n i t o r e n t r y w h i c h p r e - c l u d e s t h e i r use in c e r t a i n s i t u a t i o n s a n d l e a d s to a w k w a r d s y s t e m c o n s t r u c t i o n s . A c k n o w l e d g e m e n t s T h e a u t h o r s a r e g r a t e f u l to A. M a h j o u b , P. H a r t e r , a n d K. E k a n a d h a m for d i s c u s s i o n a b o u t t h e m a t e r i a l p r e s e n t e d here.

(4)

S

u s e r s

Figure

1

users

~ ~

i

cheduler

Disk

(5)

t y p e d i s k s c h e d = m o n i t o r ( d i s k d r i v e : d i s k ) ; c o n s t d i s k s i z e = D ; ( * n u m b e r o f t r a c k s o n d i s k *) v a t i n c r , l a s t i n c r : b o o l e a n ; t r a c k s s c a n n e d , c u r a d d r , l a s t a d d r : i n t e g e r ; f u n c t i o n p r i o r i t y b e g i n if i n c r a n d e n d ; ( t r k n o : i n t e g e r ) : i n t e g e r ; ( t r k n o > c u r a d d r ) t h e n p r i o r i t y -- t r k n o + t r a c k s s c a n n e d e l s e i f i n c r t h e n p r i o r i t y := d i s k s i z e - t r k n o + d i s k s i z e + t r a c k s s c a n n e d e l s e i f n o t i n c r a n d t r k n o < c u r a d d r t h e n p r i o r i t y := d i s k s i z e - t r k n o + t r a c k s s c a n n e d e l s e p r i o r i t y := d i s k s i z e + t r k n o + t r a c k s s c a n n e d (* s c h e d u l e d i s c i p l i n e *) p r o c e d u r e entr_____~y a c c e s s d i s k ( t r k a d d e r : i n t e g e r ; v a r b l o c k : p a g e ; i o t y p e : ( r e a d , w r i t e ) ) u s e p r i o r i t y ( t r k a d d e r ) ; b e g i n l a s t a d d r := c u r a d d r ; c u r a d d r := t r k a d d e r ; l a s t i n c r := i n c r ; if c u r a d d r > l a s t a d d r t h e n i n c r := t r u e e l s e i n c r := f a l s e ; if n o t ( l a s t i n c r = i n c r ) t h e n t r a c k s s c a n n e d := t r a c k s s c a n n e d + d i s k s i z e ; c a l l d i s k d r i v e ( b l o c k , i o t y p e ) ; e n d ; b e g i n (* i n i t i a l i z a t i o n *) i n c r := t r u e ; c u r a d d r := 0 ; t r a c k s s c a n n e d := 0 e n d F i g u r e 3 - E x a m p l e 19

(6)

A78 B72 B75 B76 G77 H74 H77 K77 L77 P78 S77 W78 R e f e r e n c e s

Andrews, G.R., McGraw, J.R.r "Language F e a t u r e s for

P r o c e s s I n t e r a c t i o n " , O_perating S_j{stems Reviewr Vol llr No. 2 (April 1977) pp 114-127.

B r i n c h Hansen, Per, _Operating S y s t e m P r i n c i p l e s P r e n t i c e Hall, N e w Jersey, 1973.

B r i n c h Hansen, Per, "The P r o g r a m m i n g L a n g u a g e C o n c u r r e n t Pascal", IEEE T r a n s a c t i o n s on Software Engineering,

SE-I,2 (June 1975) pp 199-206.

B r i n c h Hansen, Per, "The Solo O p e r a t i n g System: A C o n c u r r e n t P a s c a l Program", S o f t w a r e P r a c t i c e and Experience, Vol 6 pp 141 - 149.

Graf, N., Kretschmar, H., Lohr, L.P., Morawetz, B., "How to D e s i g n and I m p l e m e n t Small T i m e - S h a r i n g Systems Using Con- c u r r e n t Pascal", TR-77-09, F a c h b e r e i c h Informatik, TU B e r l i n

(1977) .

Hoare, C.A.R., "Monitors: An O p e r a t i n g System S t r u c t u r i n g Concept", C A C M 17,10 (Oct 1974), pp 549 - 557.

Haddon, B.K., "Nested M o n i t o r Calls", O p e r a t i n g S y s t e m s R e v i e w Vol ii, No. 4 (Oct 1977), pp 18 - 23.

Kieburtz, R.B., Silberschatz, A., "Capability M a n a g e r s " TR 71, Dept. of C o m p u t e r Science, S.U.N.Y. at S t o n y B r o o k

(May 1977).

Lister, A., "The P r o b l e m of N e s t e d M o n i t o r Calls", O p e r a t i n g S y s t e m s Review, Vol ii, No. 2 (July 1977), pp 5 - 7.

Parnas, D.L., "The N o n - p r o b l e m of Nested M o n i t o r Calls", O p e r a t i n g S y s t e m s R e v i e w , Vol 12, No. 1 (Jan. 1978) pp 12 - 14.

S i l b e r s c h a t z , A., Kieburtz, R.B., Berstein, A.J., " E x t e n d i n g C o n c u r r e n t Pascal to A l l o w Dynamic R e s o u r c e M a n a g e m e n t " ,

IEEE T r a n s a c t i o n s on S o f t w a r e Engineering, SE-3, No. 3 (May 1977).

W e t t s t e i n , H., "The P r o b l e m of Nested M o n i t o r Calls Re-

References

Related documents

For the cross–sectional reconstruction of the latent factor we propose an iterated process in which we estimate the volatility dynamics of the factor from the time series of a

Ozkan (2007) in a research titled &#34;corporate governance and CEO compensation in UK companies&#34; studied the performance of companies and effect of

Associate Director of Emergency Medical Services Assistant Professor of Clinical Emergency Medicine SUNY Stony Brook. Stony Brook, New York Evan Stein,

and Infection Control, Quality Control and Blood Bank Procedures and Protocols categories by putting the date the task..

Office for the catalysts of transcript to be a different programs have declared major, stony brook transcript request to make the requirements while student has been completed form

I AUTHORIZE the TEACHER CERTIFICATION OFFICE at S TONY BROOK UNIVERSITY , to disclose my social security number, date of birth, academic transcript, and any other

When you have selected a Practicum topic and team, you will complete Form B: Practicum Team Information and Form C: Practicum Proposal, which requires the signature of your

The Cost Benefit Analysis (CBA) in gender analysis is a methodology for estimating the costs and benefits of interventions that would reduce gender inequalities