¸®´ª½º ÇÁ·Î±×·¡¸Ó¸¦ À§ÇÑ °¡À̵å
³»ºÎ ÀÚ·á ±¸Á¶ (Internal Data Structures)
¼¼¸¶ÆÛ ÁýÇÕÀ» À§ÇØ Ä¿³Î¿¡ ÀÇÇØ °ü¸®µÇ´Â ÀÚ·á ±¸Á¶¸¦ °£´ÜÈ÷ »ìÆ캸ÀÚ.
Ä¿³Î semid ds ±¸Á¶ (Kernel semid ds structure)
¸Þ¼¼Áö Å¥¿¡¼ ó·³, Ä¿³ÎÀº ÁÖ¼Ò ¸Å°ÜÁø °ø°£(addressinf space)¿¡ ÀÖ´Â °¢°¢ÀÇ ¼¼¸¶ÆÛ ÁýÇÕÀ»
À§ÇÑ Æ¯º°ÇÑ ³»ºÎ ÀÚ·á ±¸Á¶¸¦ °ü¸®ÇÑ´Ù. semid_ds ŸÀÔÀÇ ±¸Á¶´Â ´ÙÀ½°ú °°ÀÌ /linux/sem.h ¾È¿¡
Á¤ÀǵǾî ÀÖ´Ù.:
/* ½Ã½ºÅÛ »ó¿¡¼ÀÇ °¢°¢ÀÇ ¼¼¸¶ÆÛ ÁýÇÕ¿¡ ´ëÇÑ semid ÀÚ·á ±¸Á¶ */
struct semid_ds {
struct ipc_perm sem_perm; /* permissions .. see ipc.h */
time_t sem_otime; /* last semop time */
time_t sem_ctime; /* last change time */
struct sem *sem_base; /* ptr to first semaphore in array */
struct wait_queue *eventn;
struct wait_queue *eventz;
struct sem_undo *undo; /* undo requests on this array */
ushort sem_nsems; /* no. of semaphores in array */
};
¸Þ¼¼Áö Å¥¿¡¼ ó·³, ±¸Á¶ÀÇ µ¿ÀÛµéÀº Ưº°ÇÑ ½Ã½ºÅÛ È£Ãâ¿¡ ÀÇÇØ ¼öÇàµÇ°í Á÷Á¢ÀûÀ¸·Î ´Ù·ç¾î
Áú ¼ö ¾ø´Ù. ¿©±â °¢ Çʵ忡 ´ëÇÑ º¸´Ù ÀûÀýÇÑ ¼³¸íÀÌ ÀÖ´Ù.:
- sem_perm
- ÀÌ°ÍÀº linux/ipc.h¿¡ Á¤ÀÇµÈ ipc_perm ±¸Á¶ÀÇ ÇÑ ¿¹ÀÌ´Ù. ÀÌ°ÍÀº ¼¼¸¶ÆÛ ÁýÇÕ¿¡
´ëÇÑ Çã°¡»çÇ× Á¤º¸¸¦ Æ÷ÇÔÇÑ´Ù.
- sem_otime
- °¡Àå ¸¶Áö¸· semop() µ¿ÀÛÀÇ ¼öÇà½Ã°£
- sem_ctime
- ÀÌ ±¸Á¶ÀÇ °¡Àå ¸¶Áö¸· º¯°æ ½Ã°£ (mode º¯°æ µî)
- sem_base
- ¹è¿ÀÇ Ã¹¹ø° ¼¼¸¶ÆÛ¸¦ °¡¸®Å°´Â Æ÷ÀÎÅÍ
- sem_undo
- ¹è¿¾È¿¡ ÀÖ´Â undoÀÇ ¼ö
- sem_nsems
- ¼¼¸¶ÆÛ ÁýÇվȿ¡ ÀÖ´Â ¼¼¸¶ÆÛÀÇ ¼ö
Ä¿³Î sem ±¸Á¶ (Kernel sem structure)
semid_ds ±¸Á¶¿¡´Â ¼¼¸¶ÆÛ ¹è¿ ÀÚüÀÇ º£À̽º(base)¸¦ °¡¸®Å°´Â Æ÷ÀÎÅÍ°¡ ÀÖ´Ù.
°¢°¢ÀÇ ¹è¿ ¸â¹ö´Â sem ±¸Á¶ ŸÀÔÀÌ´Ù. ÀÌ°ÍÀº linux/sem.h¿¡ Á¤ÀǵǾîÀÖ´Ù.
/* ½Ã½ºÅÛ¿¡¼ÀÇ °¢ ¼¼¸¶ÆÛ¸¦ À§ÇÑ ¼¼¸¶ÆÛ ±¸Á¶ */
struct sem {
short sempid; /* pid of last operation */
ushort semval; /* current value */
ushort semncnt; /* num procs awaiting increase in semval */
ushort semzcnt; /* num procs awaiting semval = 0 */
};
- sem_pid
- ¸¶Áö¸· µ¿ÀÛÀ» ¼öÇàÇÑ ÇÁ·Î¼¼½º ID(PID)
- sem_semval
- ¼¼¸¶ÆÛÀÇ ÇöÀç °ª
- sem_semcnt
- ÀÚ¿øÀÌ »ç¿ëÇÒ ¼ö ÀÖ°Ô µÇ±â¸¦ ±â´Ù¸®´Â ÇÁ·Î¼¼½ºÀÇ ¼ö
- sem_semzcnt
- 100% ÀÚ¿ø È°¿ëÀ» À§ÇØ ±â´Ù¸®´Â ÇÁ·Î¼¼½ºÀÇ ¼ö
ÀÌÀü:±âº» °³³ä (Basic Concepts)
´ÙÀ½:½Ã½ºÅÛ È£Ãâ:semget() (SYSTEM CALL:semget())
Copyright (c) 1996,1997 by Euibeom.Hwang & SangEun.Oh All Rights Reserved
Email To:Webmaster ,
Another address
LAST UPDATE Nov 24,1997
Created Nov 24,1997