2005 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Su

Size: px
Start display at page:

Download "2005 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Su"

Transcription

1 Sun Microsystems, Inc Network Circle Santa Clara, CA U.S.A

2 2005 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Sun docs.sun.com AnswerBook AnswerBook2 Solaris Sun Microsystems, Inc. / SPARC SPARC International, Inc. / SPARC Sun Microsystems, Inc. OPEN LOOK Sun TM Sun Microsystems, Inc. Sun Xerox Sun Xerox Xerox OPEN LOOK GUI Sun Sun Sun Microsystems, Inc. FAR Federal Acquisition Regulations @15490

3 RPC

4 ID Fork

5

6

7 5 Solaris fork Fork-One Fork-all Fork exec exit LWP POSIX setjmp longjmp LWP I/O I/O I/O I/O I/O getc putc MT

8 MT Solaris POSIX <thread.h> <pthread.h> _REENTRANT _POSIX_C_SOURCE libthread libpthread POSIX -lrt TNF truss mdb dbx Solaris Solaris POSIX API API Solaris

9 Solaris

10 fork() Solaris A grep tgrep B Solaris barrier.c

11 Solaris TM (Solaris Operating System, Solaris OS POSIX Solaris POSIX Solaris POSIX Solaris UNIX SVR4 Solaris C C Solaris SPARC x86 UltraSPARC SPARC64 AMD64 Pentium Xeon EM64T Solaris 10 Hardware Compatibility List "x86" AMD64 Intel Xeon/Pentium Solaris 10 Hardware Compatibility List 1 2 POSIX

12 8 Solaris POSIX 9 A POSIX B Solaris Sun docs.sun.com SM Web Sun docs.sun.com URL Alan Burns Geoff Davies Concurrent Programming Addison-Wesley 1993 Michel Raynal Distributed Algorithms and Protocols Wiley 1998 Silberschatz Peterson Galvin Operating System Concepts Addison-Wesley 1991 M. Ben-Ari Principles of Concurrent Programming Prentice-Hall 1982 Steve Kleiman Devang Shah Bart Smalders Programming with Threads Prentice Hall 1996 P 1 AaBbCc123.login ls -a machine_name% you have mail

13 P 1 AaBbCc123 machine_name% su Password: AaBbCc123 rm filename AaBbCc123 class 6 shell C shell Bourne shell Korn shell P 2 Shell Shell C shell C shell machine_name% machine_name# Bourne shell Korn shell $ Bourne shell Korn shell # 13

14 14

15 1 1 UNIX (multithreading, MT) Process Thread POSIX pthread Solaris thread Solaris single-threaded Multithreading fork(2) UNIX ID POSIX POSIX Sun Microsystems TM pthread 15

16 1 1 User-level or Application-level thread Lightweight process Bound thread Unbound thread Attribute object Mutual exclusion lock Condition variable Read-write lock Counting semaphore Parallelism Concurrency LWP Solaris 9 LWP Solaris 9 LWP Solaris 9 LWP Solaris 9 LWP Solaris 9 LWP POSIX (mutex) UNIX POSIX Portable Operating System Interface a POSIX IEEE Std ISO/IEC POSIX IEEE Std :2001 ISO/IEC 9945:2002 UNIX 3 Solaris

17 GUI 1 17

18 RPC (remote procedure call, RPC) UNIX Solaris 9 Solaris POSIX libpthread Solaris libthread C

19 ID PC POSIX (SCHED_FIFO) (SCHED_RR) (SCHED_OTHER) SCHED_FIFO SCHED_RR FIFO SCHED_FIFO SCHED_RR POSIX Realtime SCHED_OTHER SCHED_OTHER 149 LWP (PTHREAD_SCOPE_PROCESS) (PTHREAD_SCOPE_SYSTEM) Solaris 9 pthread 1 19

20 64 64 Solaris C 64 LP64 long ILP32 int long EB 32 4GB MB 2MB LP64 libkvm /dev/mem /dev/kmem /proc /proc Solaris

21

22 22

23 2 POSIX POSIX Solaris NULL pthread_attr_init() 50 pthread_create pthread_create(3c) int pthread_create(pthread_t *tid, const pthread_attr_t *tattr, void*(*start_routine)(void *), void *arg); 23

24 #include <pthread.h> pthread_attr_t() tattr; pthread_t tid; extern void *start_routine(void *arg); void *arg; int ret; /* default behavior*/ ret = pthread_create(&tid, NULL, start_routine, arg); /* initialized with default attributes */ ret = pthread_attr_init(&tattr); /* default behavior specified*/ ret = pthread_create(&tid, &tattr, start_routine, arg); attr pthread_create() start_routine start_routine start_routine 23 pthread_create pthread_create() ID tid NULL pthread_create() pthread_create() tattr pthread_create pthread_create() pthread_create() EAGAIN : EINVAL : tattr

25 pthread_join() pthread_join pthread_join(3c) int pthread_join(thread_t tid, void **status); #include <pthread.h> pthread_t tid; int ret; void *status; /* waiting to join thread "tid" with status */ ret = pthread_join(tid, &status); /* waiting to join thread "tid" without status */ ret = pthread_join(tid, NULL); 52 status NULL status pthread_join() ESRCH pthread_join() pthread_join pthread_join() pthread_join() 2 25

26 ESRCH : ID EDEADLK : A B EINVAL : ID pthread_join() 2 1 fetch() fetch() pthread_join() pbe malloc 2 1 void mainline (...) { struct phonebookentry *pbe; pthread_attr_t tattr; pthread_t helper; void *status; pthread_create(&helper, NULL, fetch, &pbe); /* do something else for a while */

27 2 1 pthread_join(helper, &status); /* it s now safe to use result */ void *fetch(struct phonebookentry *arg) { struct phonebookentry *npbe; /* fetch value from a database */ npbe = search (prog_name) if (npbe!= NULL) *arg = *npbe; pthread_exit(0); struct phonebookentry { char name[64]; char phonenumber[32]; char flags[16]; 2 27

28 pthread_detach(3c) pthread_join(3c) detachstate PTHREAD_CREATE_JOINABLE pthread_detach int pthread_detach(thread_t tid); #include <pthread.h> pthread_t tid; int ret; /* detach thread tid */ ret = pthread_detach(tid); pthread_detach() tid tid pthread_detach() pthread_detach pthread_detach() pthread_detach() EINVAL : tid ESRCH : tid C C TSD key (void *)

29 pthread_key_create int pthread_key_create(pthread_key_t *key, void (*destructor) (void *)); #include <pthread.h> pthread_key_t key; int ret; /* key create without destructor */ ret = pthread_key_create(&key, NULL); /* key create with destructor */ ret = pthread_key_create(&key, destructor); pthread_key_create(3c) NULL pthread_key_create() destructor pthread_key_create() key destructor NULL destructor NULL destructor destructor pthread_key_create pthread_key_create() pthread_key_create() 2 29

30 EAGAIN : key ENOMEM : pthread_key_delete(3c) Solaris pthread_key_delete int pthread_key_delete(pthread_key_t key); #include <pthread.h> pthread_key_t key; int ret; /* key previously created */ ret = pthread_key_delete(key); pthread_setspecific() pthread_getspecific() pthread_key_create() pthread_key_delete() pthread_key_delete() key pthread_key_create() pthread_key_delete pthread_key_delete() pthread_key_delete() EINVAL : key

31 pthread_setspecific(3c) pthread_setspecific int pthread_setspecific(pthread_key_t key, const void *value); #include <pthread.h> pthread_key_t key; void *value; int ret; /* key previously created */ ret = pthread_setspecific(key, value); pthread_setspecific pthread_setspecific() pthread_setspecific() ENOMEM : EINVAL : key pthread_setspecific() pthread_getspecific(3c) value pthread_getspecific void *pthread_getspecific(pthread_key_t key); 2 31

32 #include <pthread.h> pthread_key_t key; void *value; /* key previously created */ value = pthread_getspecific(key); pthread_getspecific pthread_getspecific 2 2 errno mywindow 2 2 body() {... while (write(fd, buffer, size) == -1) { if (errno!= EINTR) { fprintf(mywindow, "%s\n", strerror(errno)); exit(1);

33 2 2 errno errno mywindow stdio IO errno mywindow errno mywindow mywindow mywindow _mywindow() pthread_getspecific() pthread_getspecific() mywindow_key win 2 3 thread_key_t mywin_key; FILE *_mywindow(void) { FILE *win; win = pthread_getspecific(mywin_key); return(win); #define mywindow _mywindow() void routine_uses_win( FILE *win) {

34 2 3 void thread_start(...) {... make_mywin();... routine_uses_win( mywindow )... mywin_key make_mywin() mywindow mywindow _mywindow() mywindow void make_mywindow(void) { FILE **win; static pthread_once_t mykeycreated = PTHREAD_ONCE_INIT; pthread_once(&mykeycreated, mykeycreate); win = malloc(sizeof(*win)); create_window(win,...);

35 2 4 pthread_setspecific(mywindow_key, win); void mykeycreate(void) { pthread_key_create(&mywindow_key, free_key); void free_key(void *win) { free(win); mywin_key make_mywin() pthread_key_create() key destructor create_window() win pthread_setspecific() win pthread_getspecific() key pthread_setspecific() pthread_key_create() destructor destructor pthread_setspecific() key pthread_self(3c) thread identifier pthread_self pthread_t pthread_self(void); 2 35

36 #include <pthread.h> pthread_t tid; tid = pthread_self(); pthread_self pthread_self() thread identifier ID pthread_equal(3c) pthread_equal int pthread_equal(pthread_t tid1, pthread_t tid2); #include <pthread.h> pthread_t tid1, tid2; int ret; ret = pthread_equal(tid1, tid2); pthread_equal tid1 tid2 pthread_equal() tid1 tid2 pthread_once(3c) pthread_once pthread_once()

37 pthread_once int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)); #include <pthread.h> pthread_once_t once_control = PTHREAD_ONCE_INIT; int ret; ret = pthread_once(&once_control, init_routine); once_control pthread_once pthread_once() pthread_once() EINVAL : once_control init_routine NULL sched_yield(3rt) sched_yield int sched_yield(void); #include <sched.h> int ret; ret = sched_yield(); 2 37

38 sched_yield sched_yield() -1 errno ENOSYS : sched_yield pthread_setschedparam(3c) pthread_setschedparam int pthread_setschedparam(pthread_t tid, int policy, const struct sched_param *param); #include <pthread.h> pthread_t tid; int ret; struct sched_param param; int priority; /* sched_priority will be the priority of the thread */ sched_param.sched_priority = priority; policy = SCHED_OTHER; /* scheduling parameters of target thread */ ret = pthread_setschedparam(tid, policy, &param);

39 pthread_setschedparam pthread_setschedparam() pthread_setschedparam() EINVAL : ENOTSUP : pthread_getschedparam(3c) pthread_getschedparam int pthread_getschedparam(pthread_t tid, int policy, struct schedparam *param); #include <pthread.h> pthread_t tid; sched_param param; int priority; int policy; int ret; /* scheduling parameters of target thread */ ret = pthread_getschedparam (tid, &policy, &param); /* sched_priority contains the priority of the thread */ priority = param.sched_priority; 2 39

40 pthread_getschedparam pthread_getschedparam() ESRCH : tid pthread_kill(3c) pthread_kill int pthread_kill(thread_t tid, int sig); #include <pthread.h> #include <signal.h> int sig; pthread_t tid; int ret; ret = pthread_kill(tid, sig); pthread_kill() sig tid tid sig signal(5) sig tid pthread_kill pthread_kill() pthread_kill() EINVAL : sig ESRCH : tid

41 pthread_sigmask(3c) pthread_sigmask int pthread_sigmask(int how, const sigset_t *new, sigset_t *old); #include <pthread.h> #include <signal.h> int ret; sigset_t old, new; ret = pthread_sigmask(sig_setmask, &new, &old); /* set new mask */ ret = pthread_sigmask(sig_block, &new, &old); /* blocking mask */ ret = pthread_sigmask(sig_unblock, &new, &old); /* unblocking */ how how SIG_BLOCK new new SIG_UNBLOCK new new SIG_SETMASK new new new NULL how NULL new old NULL old pthread_sigmask pthread_sigmask() pthread_sigmask() EINVAL : how Fork 146 pthread_atfork pthread_atfork(3c) 2 41

42 pthread_atfork int pthread_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void) ); pthread_atfork pthread_atfork() pthread_atfork() ENOMEM : Fork pthread_exit(3c) pthread_exit void pthread_exit(void *status); #include <pthread.h> void *status; pthread_exit(status); /* exit with status */ pthread_exit() ID status pthread_join() status ID 52 pthread_exit status pthread_create pthread_exit()

43 POSIX pthread_cancel() "joining" pthread_create() pthread_detach join joining main() main() exit() main() pthread_exit pthreads pthread_testcancel pthread_cond_wait pthread_cond_timedwait(3c) sigwait(2) cancellation(5) 45 pthread_setcancelstate 2 43

44 C pthread_setcancelstate(3c) pthread_setcanceltype(3c) pthread_testcancel() POSIX pthread_cancel(3c) pthread_cancel int pthread_cancel(pthread_t thread); #include <pthread.h> pthread_t thread; int ret; ret = pthread_cancel(thread); pthread_setcancelstate(3c) pthread_setcanceltype(3c)

45 pthread_cancel pthread_cancel() ESRCH : ID pthread_setcancelstate(3c) pthread_setcancelstate int pthread_setcancelstate(int state, int *oldstate); #include <pthread.h> int oldstate; int ret; /* enabled */ ret = pthread_setcancelstate(pthread_cancel_enable, &oldstate); /* disabled */ ret = pthread_setcancelstate(pthread_cancel_disable, &oldstate); pthread_setcancelstate pthread_setcancelstate() pthread_setcancelstate() EINVAL : PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_DISABLE 2 45

46 pthread_setcanceltype(3c) pthread_setcanceltype int pthread_setcanceltype(int type, int *oldtype); #include <pthread.h> int oldtype; int ret; /* deferred mode */ ret = pthread_setcanceltype(pthread_cancel_deferred, &oldtype); /* async mode*/ ret = pthread_setcanceltype(pthread_cancel_asynchronous, &oldtype); pthread_setcanceltype pthread_setcanceltype() EINVAL : PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_ASYNCHRONOUS pthread_testcancel(3c) pthread_testcancel void pthread_testcancel(void);

47 #include <pthread.h> pthread_testcancel(); pthread_testcancel() pthread_testcancel() pthread_testcancel() pthread_testcancel() pthread 43 pthread_testcancel pthread_testcancel() pthread_cleanup_push(3c) pthread_cleanup_pop(3c) pthread_cleanup_push pthread_cleanup_push(3c) (LIFO) void pthread_cleanup_push(void(*routine)(void *), void *args); #include <pthread.h> /* push the handler "routine" on cleanup stack */ pthread_cleanup_push (routine, arg); pthread_cleanup_push pthread_cleanup_push() pthread_cleanup_pop(3c) 2 47

48 pthread_cleanup_pop void pthread_cleanup_pop(int execute); #include <pthread.h> /* pop the "func" out of cleanup stack and execute "func" */ pthread_cleanup_pop (1); /* pop the "func" and DONT execute "func" */ pthread_cleanup_pop (0); pthread_exit(3c) pthread_cleanup_pop() pthread_cleanup_pop pthread_cleanup_pop()

49 3 pthreads API POSIX Solaris pthreads 8 pthread_create(3c) 49

50 pthreads pthread_attr_init(3c) pthread_attr_init int pthread_attr_init(pthread_attr_t *tattr); #include <pthread.h> pthread_attr_t tattr; int ret; /* initialize an attribute to the default value */ ret = pthread_attr_init(&tattr); 3 1 (tattr) 3 1 tattr scope PTHREAD_SCOPE_PROCESS detachstate PTHREAD_CREATE_JOINABLE ID stackaddr NULL stacksize 0 priority

51 3 1 tattr inheritsched PTHREAD_EXPLICIT_SCHED schedpolicy SCHED_OTHER Solaris pthread_attr_init pthread_attr_init() ENOMEM : pthread_attr_destroy(3c) pthread_attr_destroy int pthread_attr_destroy(pthread_attr_t *tattr); #include <pthread.h> pthread_attr_t tattr; int ret; /* destroy an attribute */ ret = pthread_attr_destroy(&tattr); pthread_attr_destroy pthread_attr_destroy() EINVAL : tattr 3 51

52 (PTHREAD_CREATE_DETACHED) ID pthread_attr_setdetachstate(3c) pthread_attr_setdetachstate(3c) int pthread_attr_setdetachstate(pthread_attr_t *tattr,int detachstate); #include <pthread.h> pthread_attr_t tattr; int ret; /* set the thread detach state */ ret = pthread_attr_setdetachstate(&tattr,pthread_create_detached); PTHREAD_CREATE_JOINABLE pthread_join() main() 42 pthread_create() ID join 3 1 #include <pthread.h> pthread_attr_t tattr; pthread_t tid; void *start_routine;

53 3 1 void arg int ret; /* initialized with default attributes */ ret = pthread_attr_init (&tattr); ret = pthread_attr_setdetachstate (&tattr,pthread_create_detached); ret = pthread_create (&tid, &tattr, start_routine, arg); pthread_attr_setdetachstate pthread_attr_setdetachstate() EINVAL : detachstate tattr pthread_attr_getdetachstate(3c) pthread_attr_getdetachstate int pthread_attr_getdetachstate(const pthread_attr_t *tattr, int *detachstate; #include <pthread.h> pthread_attr_t tattr; int detachstate; int ret; 3 53

54 /* get detachstate of thread */ ret = pthread_attr_getdetachstate (&tattr, &detachstate); pthread_attr_getdetachstate pthread_attr_getdetachstate() EINVAL : detachstate NULL tattr pthread_attr_setguardsize(3c) attr guardsize pthread_attr_setguardsize(3c) #include <pthread.h> int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize); guardsize guardsize SIGSEGV guardsize attr guardsize attr guardsize guardsize PAGESIZE sys/mman.h PAGESIZE guardsize PAGESIZE guardsize pthread_attr_setguardsize() attr pthread_attr_getguardsize() pthread_attr_setguardsize pthread_attr_setguardsize()

55 EINVAL : attr guardsize guardsize pthread_attr_getguardsize(3c) attr guardsize pthread_attr_getguardsize #include <pthread.h> int pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize); guardsize PAGESIZE sys/mman.h PAGESIZE guardsize PAGESIZE guardsize pthread_attr_setguardsize() attr pthread_attr_getguardsize() pthread_attr_getguardsize pthread_attr_getguardsize() EINVAL : attr guardsize guardsize pthread_attr_setscope(3c) PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_PROCESS pthread_attr_setscope int pthread_attr_setscope(pthread_attr_t *tattr,int scope); #include <pthread.h> 3 55

56 pthread_attr_t tattr; int ret; /* bound thread */ ret = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM); /* unbound thread */ ret = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_PROCESS); pthreads #include <pthread.h> pthread_attr_t attr; pthread_t tid; void start_routine; void arg; int ret; /* initialized with default attributes */ ret = pthread_attr_init (&tattr); /* BOUND behavior */ ret = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM); ret = pthread_create (&tid, &tattr, start_routine, arg);

57 pthread_attr_setscope pthread_attr_setscope() EINVAL : tattr pthread_attr_getscope(3c) pthread_attr_getscope int pthread_attr_getscope(pthread_attr_t *tattr, int *scope); #include <pthread.h> pthread_attr_t tattr; int scope; int ret; /* get scope of thread */ ret = pthread_attr_getscope(&tattr, &scope); pthread_attr_getscope pthread_attr_getscope() EINVAL : scope NULL tattr pthread_setconcurrency(3c) pthread_setconcurrency() Solaris 9 LWP 3 57

58 pthread_setconcurrency #include <pthread.h> int pthread_setconcurrency(int new_level); pthread_setconcurrency pthread_setconcurrency() EINVAL : new_level EAGAIN : new_level pthread_getconcurrency(3c) pthread_setconcurrency() pthread_getconcurrency #include <pthread.h> int pthread_getconcurrency(void); pthread_setconcurrency() pthread_getconcurrency() pthread_getconcurrency pthread_getconcurrency() pthread_setconcurrency() pthread_setconcurrency() pthread_getconcurrency() pthread_attr_setschedpolicy(3c) POSIX SCHED_FIFO SCHED_RR SCHED_OTHER pthread_attr_setschedpolicy(3c) int pthread_attr_setschedpolicy(pthread_attr_t *tattr, int policy);

59 #include <pthread.h> pthread_attr_t tattr; int policy; int ret; /* set the scheduling policy to SCHED_OTHER */ ret = pthread_attr_setschedpolicy(&tattr, SCHED_OTHER); SCHED_FIFO ID 0 (PTHREAD_SCOPE_SYSTEM) (RT) (PTHREAD_SCOPE_PROCESS)) ID 0 SCHED_FIFO SCHED_FIFO TS SCHED_RR ID 0 (PTHREAD_SCOPE_SYSTEM)) (RT) (PTHREAD_SCOPE_PROCESS) SCHED_RR TS ID 0 SCHED_FIFO SCHED_RR POSIX 19 pthread_attr_setschedpolicy pthread_attr_setschedpolicy() EINVAL : tattr ENOTSUP : pthread_attr_getschedpolicy(3c) 3 59

60 pthread_attr_getschedpolicy int pthread_attr_getschedpolicy(pthread_attr_t *tattr, int *policy); #include <pthread.h> pthread_attr_t tattr; int policy; int ret; /* get scheduling policy of thread */ ret = pthread_attr_getschedpolicy (&tattr, &policy); pthread_attr_getschedpolicy pthread_attr_getschedpolicy() EINVAL : policy NULL tattr pthread_attr_setinheritsched(3c) pthread_attr_setinheritsched int pthread_attr_setinheritsched(pthread_attr_t *tattr, int inherit); #include <pthread.h> pthread_attr_t tattr; int inherit; int ret;

61 /* use the current scheduling policy */ ret = pthread_attr_setinheritsched(&tattr, PTHREAD_EXPLICIT_SCHED); inherit PTHREAD_INHERIT_SCHED pthread_create() PTHREAD_EXPLICIT_SCHED pthread_create() pthread_attr_setinheritsched pthread_attr_setinheritsched() EINVAL : tattr ENOTSUP : pthread_attr_getinheritsched(3c) pthread_attr_setinheritsched() pthread_attr_getinheritsched int pthread_attr_getinheritsched(pthread_attr_t *tattr, int *inherit); #include <pthread.h> pthread_attr_t tattr; int inherit; int ret; /* get scheduling policy and priority of the creating thread */ ret = pthread_attr_getinheritsched (&tattr, &inherit); 3 61

62 pthread_attr_getinheritsched pthread_attr_getinheritsched() EINVAL : inherit NULL tattr pthread_attr_setschedparam(3c) pthread_attr_setschedparam int pthread_attr_setschedparam(pthread_attr_t *tattr, const struct sched_param *param); #include <pthread.h> pthread_attr_t tattr; int newprio; sched_param param; newprio = 30; /* set the priority; others are unchanged */ param.sched_priority = newprio; /* set the new scheduling param */ ret = pthread_attr_setschedparam (&tattr, &param); param

63 pthread_attr_setschedparam pthread_attr_setschedparam() EINVAL : param NULL tattr pthreads pthread_attr_getschedparam(3c) pthread_attr_setschedparam() pthread_attr_getschedparam int pthread_attr_getschedparam(pthread_attr_t *tattr, const struct sched_param *param); #include <pthread.h> pthread_attr_t attr; struct sched_param param; int ret; /* get the existing scheduling param */ ret = pthread_attr_getschedparam (&tattr, &param); sched_param 3 63

64 #include <pthread.h> #include <sched.h> pthread_attr_t tattr; pthread_t tid; int ret; int newprio = 20; sched_param param; /* initialized with default attributes */ ret = pthread_attr_init (&tattr); /* safe to get existing scheduling param */ ret = pthread_attr_getschedparam (&tattr, &param); /* set the priority; others are unchanged */ param.sched_priority = newprio; /* setting the new scheduling param */

65 3 2 ret = pthread_attr_setschedparam (&tattr, &param); /* with new priority specified */ ret = pthread_create (&tid, &tattr, func, arg); pthread_attr_getschedparam pthread_attr_getschedparam() EINVAL : param NULL tattr pthread_attr_setstacksize(3c) pthread_attr_setstacksize int pthread_attr_setstacksize(pthread_attr_t *tattr, size_t size); #include <pthread.h> pthread_attr_t tattr; size_t size; int ret; size = (PTHREAD_STACK_MIN + 0x4000); /* setting a new size */ ret = pthread_attr_setstacksize(&tattr, size); 3 65

66 stacksize size 67 size size PTHREAD_STACK_MIN pthread_attr_setstacksize pthread_attr_setstacksize() EINVAL : size PTHREAD_STACK_MIN tattr pthread_attr_getstacksize(3c) pthread_attr_setstacksize() pthread_attr_getstacksize int pthread_attr_getstacksize(pthread_attr_t *tattr, size_t *size); #include <pthread.h> pthread_attr_t tattr; size_t size; int ret; /* getting the stack size */ ret = pthread_attr_getstacksize(&tattr, &size);

67 pthread_attr_getstacksize pthread_attr_getstacksize() EINVAL : tattr SIGSEGV PTHREAD_CREATE_JOINABLE pthread_join(3c) pthread_join(3c) 1MB 32 2MB 64 mmap() MAP_NORESERVE / ABI 3 67

68 PTHREAD_STACK_MIN PTHREAD_STACK_MIN NULL #include <pthread.h> pthread_attr_t tattr; pthread_t tid; int ret; size_t size = PTHREAD_STACK_MIN + 0x4000; /* initialized with default attributes */ ret = pthread_attr_init(&tattr); /* setting the size of the stack also */ ret = pthread_attr_setstacksize(&tattr, size); /* only size specified in tattr*/ ret = pthread_create(&tid, &tattr, start_routine, arg); pthread_attr_setstack(3c) pthread_attr_setstack(3c) int pthread_attr_setstack(pthread_attr_t *tattr,void *stackaddr, size_t stacksize);

69 #include <pthread.h> pthread_attr_t tattr; void *base; size_t size; int ret; base = (void *) malloc(pthread_stack_min + 0x4000); /* setting a new address and size */ ret = pthread_attr_setstack(&tattr, base,pthread_stack_min + 0x4000); stackaddr stacksize stackaddr NULL stacksize base base NULL pthread_create(3c) stacksize pthread_attr_setstack(3c) pthread_attr_setstack() EINVAL : base tattr stacksize PTHREAD_STACK_MIN #include <pthread.h> pthread_attr_t tattr; pthread_t tid; int ret; 3 69

70 void *stackbase; size_t size; /* initialized with default attributes */ ret = pthread_attr_init(&tattr); /* setting the base address and size of the stack */ ret = pthread_attr_setstack(&tattr, stackbase,size); /* address and size specified */ ret = pthread_create(&tid, &tattr, func, arg); pthread_attr_getstack(3c) pthread_attr_setstack() pthread_attr_getstack int pthread_attr_getstack(pthread_attr_t *tattr,void * *stackaddr, size_t *stacksize); #include <pthread.h> pthread_attr_t tattr; void *base; size_t size; int ret;

71 /* getting a stack address and size */ ret = pthread_attr_getstackaddr (&tattr, &base, &size); pthread_attr_getstack pthread_attr_getstackaddr() EINVAL : tattr 3 71

72 72

73

74 SPARC Platform Edition 32 long long long long 32 int char float SPARC Platform Edition Intel pthread_mutexattr_init 76 pthread_mutexattr_destroy 77 pthread_mutexattr_setpshared 78 pthread_mutexattr_getpshared 78 pthread_mutexattr_settype 79 pthread_mutexattr_gettype 80 pthread_mutexattr_setprotocol 82 pthread_mutexattr_getprotocol 83 pthread_mutexattr_setprioceiling 84 pthread_mutexattr_getprioceiling 85 pthread_mutex_setprioceiling 86 pthread_mutex_getprioceiling 86 pthread_mutexattr_setrobust_np

75 pthread_mutexattr_getrobust_np 4 2 Solaris POSIX 4 2 Solaris POSIX USYNC_PROCESS PTHREAD_PROCESS_SHARED USYNC_PROCESS_ROBUST POSIX USYNC_THREAD PTHREAD_PROCESS_PRIVATE pthread_mutexattr_init(3c) pthread_mutexattr_init int pthread_mutexattr_init(pthread_mutexattr_t *mattr); #include <pthread.h> pthread_mutexattr_t mattr; int ret; /* initialize an attribute to default value */ ret = pthread_mutexattr_init(&mattr); pshared PTHREAD_PROCESS_PRIVATE mattr opaque mattr PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_PRIVATE 4 75

76 pthread_mutexattr_destroy(3c) pthread_mutexattr_init() opaque pthread_mutexattr_init pthread_mutexattr_init() ENOMEM : pthread_mutexattr_destroy(3c) pthread_mutexattr_init() pthread_mutexattr_destroy int pthread_mutexattr_destroy(pthread_mutexattr_t *mattr) #include <pthread.h> pthread_mutexattr_t mattr; int ret; /* destroy an attribute */ ret = pthread_mutexattr_destroy(&mattr); pthread_mutexattr_destroy pthread_mutexattr_destroy() EINVAL : mattr pthread_mutexattr_setpshared(3c)

77 pthread_mutexattr_setpshared int pthread_mutexattr_setpshared(pthread_mutexattr_t *mattr, int pshared); #include <pthread.h> pthread_mutexattr_t mattr; int ret; ret = pthread_mutexattr_init(&mattr); /* * resetting to its default value: private */ ret = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_PRIVATE); pshared PTHREAD_PROCESS_SHARED Solaris mutex_init() USYNC_PROCESS pshared PTHREAD_PROCESS_PRIVATE pthread_mutexattr_setpshared pthread_mutexattr_setpshared() EINVAL : mattr pthread_mutexattr_getpshared(3c) pthread_mutexattr_setpshared() 4 77

78 pthread_mutexattr_getpshared int pthread_mutexattr_getpshared(pthread_mutexattr_t *mattr, int *pshared); #include <pthread.h> pthread_mutexattr_t mattr; int pshared, ret; /* get pshared of mutex */ ret = pthread_mutexattr_getpshared(&mattr, &pshared); mattr pshared PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_PRIVATE pthread_mutexattr_getpshared pthread_mutexattr_getpshared() EINVAL : mattr pthread_mutexattr_settype(3c) type pthread_mutexattr_settype #include <pthread.h> int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); PTHREAD_MUTEX_DEFAULT type

79 PTHREAD_MUTEX_NORMAL : PTHREAD_MUTEX_ERRORCHECK : PTHREAD_MUTEX_RECURSIVE : PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_DEFAULT : Solaris PTHREAD_PROCESS_DEFAULT PTHREAD_PROCESS_NORMAL pthread_mutexattr_settype pthread_mutexattr_settype EINVAL : type EINVAL : attr pthread_mutexattr_gettype(3c) pthread_mutexattr_settype() type pthread_mutexattr_gettype #include <pthread.h> 4 79

80 int pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type); PTHREAD_MUTEX_DEFAULT type PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_DEFAULT 78 pthread_mutexattr_settype pthread_mutexattr_gettype pthread_mutexattr_gettype() 0 pthread_mutexattr_setprotocol(3c) pthread_mutexattr_setprotocol #include <pthread.h> int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol); attr pthread_mutexattr_init() protocol pthread.h protocol PTHREAD_PRIO_NONE PTHREAD_PRIO_INHERIT PTHREAD_PRIO_PROTECT PTHREAD_PRIO_NONE PTHREAD_PRIO_INHERIT thrd1 thrd1 PTHREAD_PRIO_INHERIT thrd1 thrd1 thrd1 (thrd3) thrd

81 PTHREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT _POSIX_THREAD_PRIO_INHERIT pthread_mutexattr_setrobust_np() robustness EOWNERDEAD pthread_mutex_init() pthread_mutex_init() pthread_mutex_init() pthread_mutex_lock() ENOTRECOVERABLE pthread_mutex_destroy() pthread_mutex_init() EOWNERDEAD EOWNERDEAD PTHREAD_PRIO_PROTECT PTHREAD_PRIO_PROTECT thrd2 thrd2 thrd2 thrd2 thrd2 sched_setparam() PTHREAD_PRIO_INHERIT PTHREAD_PRIO_PROTECT PTHREAD_PRIO_INHERIT PTHREAD_PRIO_PROTECT PTHREAD_PRIO_INHERIT PTHREAD_PRIO_PROTECT pthread_mutexattr_setprotocol pthread_mutexattr_setprotocol() 0 pthread_mutexattr_setprotocol() 4 81

82 ENOSYS : _POSIX_THREAD_PRIO_INHERIT _POSIX_THREAD_PRIO_PROTECT ENOTSUP : protocol pthread_mutexattr_setprotocol() EINVAL : attr protocol EPERM : pthread_mutexattr_getprotocol(3c) pthread_mutexattr_getprotocol #include <pthread.h> int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, int *protocol); attr pthread_mutexattr_init() protocol PTHREAD_PRIO_NONE PTHREAD_PRIO_INHERIT PTHREAD_PRIO_PROTECT pthread_mutexattr_getprotocol pthread_mutexattr_getprotocol() 0 pthread_mutexattr_getprotocol() ENOSYS : _POSIX_THREAD_PRIO_INHERIT _POSIX_THREAD_PRIO_PROTECT pthread_mutexattr_getprotocol()

83 EINVAL : attr EPERM : pthread_mutexattr_setprioceiling(3c) pthread_mutexattr_setprioceiling #include <pthread.h> int pthread_mutexattr_setprioceiling(pthread_mutexatt_t *attr, int prioceiling, int *oldceiling); attr pthread_mutexattr_init() prioceiling prioceiling SCHED_FIFO prioceiling oldceiling pthread_mutexattr_setprioceiling pthread_mutexattr_setprioceiling() 0 pthread_mutexattr_setprioceiling() ENOSYS : _POSIX_THREAD_PRIO_PROTECT pthread_mutexattr_setprioceiling() EINVAL : attr prioceiling EPERM : 4 83

84 pthread_mutexattr_getprioceiling(3c) pthread_mutexattr_getprioceiling #include <pthread.h> int pthread_mutexattr_getprioceiling(const pthread_mutexatt_t *attr, int *prioceiling); attr pthread_mutexattr_init() _POSIX_THREAD_PRIO_PROTECT attr pthread_mutexattr_getprioceiling() prioceiling prioceiling SCHED_FIFO prioceiling pthread_mutexattr_getprioceiling pthread_mutexattr_getprioceiling() 0 pthread_mutexattr_getprioceiling() ENOSYS : _POSIX_THREAD_PRIO_PROTECT pthread_mutexattr_getprioceiling() EINVAL : attr EPERM : pthread_mutexattr_setprioceiling(3c)

85 pthread_mutex_setprioceiling #include <pthread.h> int pthread_mutex_setprioceiling(pthread_mutex_t *mutex, int prioceiling, int *old_ceiling); pthread_mutex_setprioceiling() mutex prioceiling pthread_mutex_setprioceiling() pthread_mutex_setprioceiling() pthread_mutex_setprioceiling() old_ceiling pthread_mutex_setprioceiling() pthread_mutex_setprioceiling pthread_mutex_setprioceiling() 0 pthread_mutexatt_setprioceiling() ENOSYS : _POSIX_THREAD_PRIO_PROTECT pthread_mutex_setprioceiling() EINVAL : prioceiling EINVAL : mutex ENOSYS : EPERM : pthread_mutexattr_getprioceiling(3c) 4 85

86 pthread_mutex_getprioceiling #include <pthread.h> int pthread_mutex_getprioceiling(const pthread_mutex_t *mutex, int *prioceiling); pthread_mutex_getprioceiling() mutex prioceiling pthread_mutex_getprioceiling pthread_mutex_getprioceiling() 0 pthread_mutexatt_getprioceiling() ENOSYS : _POSIX_THREAD_PRIO_PROTECT pthread_mutex_getprioceiling() EINVAL : mutex ENOSYS : EPERM : pthread_mutexattr_setrobust_np(3c) pthread_mutexattr_setrobust_np #include <pthread.h> int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *attr, int *robustness);

87 _POSIX_THREAD_PRIO_INHERIT pthread_mutexattr_setrobust_np() attr pthread_mutexattr_init() robustness pthread.h robustness PTHREAD_MUTEX_ROBUST_NP PTHREAD_MUTEX_STALLED_NP PTHREAD_MUTEX_STALLED_NP PTHREAD_MUTEX_ROBUST_NP pthread_mutex_lock() PTHREAD_MUTEX_STALLED_NP EOWNWERDEAD pthread_mutex_lock() EOWNWERDEAD pthread_mutex_consistent_np() pthread_mutex_consistent_np() pthread_mutex_lock() ENOTRECOVERABLE pthread_mutex_destroy() pthread_mutex_int() EOWNERDEAD EOWNERDEAD pthread_mutexattr_setrobust_np pthread_mutexattr_setrobust_np() 0 pthread_mutexattr_setrobust_np() ENOSYS : _POSIX_THREAD_PRIO INHERIT pthread_mutexattr_setrobust_np() 4 87

88 ENOTSUP : robustness pthread_mutexattr_setrobust_np() EINVAL : attr robustness pthread_mutexattr_getrobust_np(3c) pthread_mutexattr_getrobust_np #include <pthread.h> int pthread_mutexattr_getrobust_np(const pthread_mutexattr_t *attr, int *robustness); _POSIX_THREAD_PRIO_INHERIT pthread_mutexattr_getrobust_np() attr pthread_mutexattr_init() robustness pthread_mutexattr_getrobust_np pthread_mutexattr_getrobust_np() 0 pthread_mutexattr_getrobust_np() ENOSYS : _POSIX_THREAD_PRIO INHERIT pthread_mutexattr_getrobust_np() pthread_mutexattr_getrobust_np() EINVAL : attr robustness

89 pthread_mutex_init 91 pthread_mutex_consistent_np 91 pthread_mutex_lock 93 pthread_mutex_unlock 94 pthread_mutex_trylock 95 pthread_mutex_destroy SCHED_OTHER pthread_mutex_init(3c) mp pthread_mutexattr_init() mattr NULL Solaris 204 mutex_init(3c) pthread_mutex_init int pthread_mutex_init(pthread_mutex_t *mp, const pthread_mutexattr_t *mattr); #include <pthread.h> pthread_mutex_t mp = PTHREAD_MUTEX_INITIALIZER; pthread_mutexattr_t mattr; int ret; /* initialize a mutex to its default value */ 4 89

90 ret = pthread_mutex_init(&mp, NULL); /* initialize a mutex */ ret = pthread_mutex_init(&mp, &mattr); mattr NULL PTHREAD_MUTEX_INITIALIZER pthread_mutex_init pthread_mutex_init() EBUSY : mp EINVAL : mattr EFAULT : mp pthread_mutex_consistent_np mutex

91 pthread_mutex_consistent_np #include <pthread.h> int pthread_mutex_consistent_np(pthread_mutex_t *mutex); _POSIX_THREAD_PRIO_INHERIT pthread_mutex_consistent_np() PTHREAD_PRIO_INHERIT pthread_mutex_lock() EOWNWERDEAD pthread_mutex_lock() pthread_mutex_consistent_np() pthread_mutex_lock() pthread_mutex_unlock() pthread_mutex_trylock() pthread_mutex_consistent_np() pthread_mutex_consistent_np pthread_mutex_consistent_np() pthread_mutex_consistent_np() ENOSYS : _POSIX_THREAD_PRIO_INHERIT pthread_mutex_consistent_np() pthread_mutex_consistent_np() EINVAL : mattr pthread_mutex_lock(3c) mutex pthread_mutex_lock int pthread_mutex_lock(pthread_mutex_t *mutex); 4 91

92 #include <pthread.h> pthread_mutex_t mutex; int ret; ret = pthread_ mutex_lock(&mp); /* acquire the mutex */ pthread_mutex_lock() Solaris 207 mutex_lock PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_DEFAULT pthread_mutex_lock pthread_mutex_lock() EAGAIN : EDEADLK : _POSIX_THREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT pthread_mutexattr_setrobust_np() robustness PTHREAD_MUTEX_ROBUST_NP

93 EOWNERDEAD : pthread_mutex_consistent_np() pthread_mutex_lock() pthread_mutex_init() pthread_mutex_lock() ENOTRECOVERABLE EOWNERDEAD EOWNERDEAD ENOTRECOVERABLE : EOWNERDEAD ENOMEM : pthread_mutex_unlock(3c) mutex Solaris 207 mutex_unlock pthread_mutex_unlock int pthread_mutex_unlock(pthread_mutex_t *mutex); #include <pthread.h> pthread_mutex_t mutex; int ret; ret = pthread_mutex_unlock(&mutex); /* release the mutex */ 4 93

94 pthread_mutex_unlock() mutex pthread_mutex_unlock() mutex PTHREAD_MUTEX_RECURSIVE pthread_mutex_unlock pthread_mutex_unlock() EPERM : pthread_mutex_trylock(3c) mutex Solaris 208 mutex_trylock pthread_mutex_trylock int pthread_mutex_trylock(pthread_mutex_t *mutex); #include <pthread.h> pthread_mutex_t mutex; int ret; ret = pthread_mutex_trylock(&mutex); /* try to lock the mutex */ pthread_mutex_trylock() pthread_mutex_lock() mutex pthread_mutex_trylock pthread_mutex_trylock() EBUSY : mutex

95 EAGAIN : mutex _POSIX_THREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT pthread_mutexattr_setrobust_np() robustness PTHREAD_MUTEX_ROBUST_NP EOWNERDEAD : pthread_mutex_consistent_np() pthread_mutex_lock() pthread_mutex_init() pthread_mutex_trylock() ENOTRECOVERABLE EOWNERDEAD EOWNERDEAD ENOTRECOVERABLE : EOWNERDEAD ENOMEM : pthread_mutex_destroy(3c) mp Solaris 206 mutex_destroy pthread_mutex_destroy int pthread_mutex_destroy(pthread_mutex_t *mp); #include <pthread.h> pthread_mutex_t mp; 4 95

96 int ret; ret = pthread_mutex_destroy(&mp); /* mutex is destroyed */ pthread_mutex_destroy pthread_mutex_destroy() EINVAL : mp #include <pthread.h> pthread_mutex_t count_mutex; long long count; void increment_count() { pthread_mutex_lock(&count_mutex); count = count + 1; pthread_mutex_unlock(&count_mutex);

97 4 1 long long get_count() { long long c; pthread_mutex_lock(&count_mutex); c = count; pthread_mutex_unlock(&count_mutex); return (c); 4 1 increment_count() get_count() 64 count 32 long long

98 pthread_mutex_lock(&m1); /* use resource 1 */ pthread_mutex_lock(&m2); /* use resources 1 and 2 */ pthread_mutex_unlock(&m2); pthread_mutex_unlock(&m1); pthread_mutex_lock(&m2); /* use resource 2 */ pthread_mutex_lock(&m1); /* use resources 1 and 2 */ pthread_mutex_unlock(&m1); pthread_mutex_unlock(&m2); n n pthread_mutex_trylock() pthread_mutex_lock(&m1); pthread_mutex_lock(&m2); /* no processing */ pthread_mutex_unlock(&m2); pthread_mutex_unlock(&m1); for (; ;) { pthread_mutex_lock(&m2); if(pthread_mutex_trylock(&m1)==0) /* got it */ break; /* didn t get it */ pthread_mutex_unlock(&m2); /* get locks; no processing */ pthread_mutex_unlock(&m1); pthread_mutex_unlock(&m2);

99 pthread_mutex_trylock() typedef struct node1 { int value; struct node1 *link; pthread_mutex_t lock; node1_t; node1_t ListHead; ListHead ListHead ListHead 4 5 C 4 5 node1_t *delete(int value) { 4 99

100 4 5 node1_t *prev, *current; prev = &ListHead; pthread_mutex_lock(&prev->lock); while ((current = prev->link)!= NULL) { pthread_mutex_lock(&current->lock); if (current->value == value) { prev->link = current->link; pthread_mutex_unlock(&current->lock); pthread_mutex_unlock(&prev->lock); current->link = NULL; return(current); pthread_mutex_unlock(&prev->lock); prev = current; pthread_mutex_unlock(&prev->lock); return(null);

101 4 6 typedef struct node2 { int value; struct node2 *link; pthread_mutex_t lock; node2_t; C 4 7 void Hit Neighbor(node2_t *me) { while (1) { pthread_mutex_lock(&me->lock); if (pthread_mutex_lock(&me->link->lock)!= 0) { /* failed to get lock */ pthread_mutex_unlock(&me->lock); continue; break; me->link->value += me->value; me->value /=2; pthread_mutex_unlock(&me->link->lock); pthread_mutex_unlock(&me->lock); 4 101

102 SCHED_OTHER pthread_condattr_init 104 pthread_condattr_destroy 104 pthread_condattr_setpshared 105 pthread_condattr_getpshared 4 5 Solaris POSIX 4 5 Solaris POSIX USYNC_PROCESS PTHREAD_PROCESS_SHARED USYNC_THREAD PTHREAD_PROCESS_PRIVATE

103 pthread_condattr_init(3c) pthread_condattr_init int pthread_condattr_init(pthread_condattr_t *cattr); #include <pthread.h> pthread_condattr_t cattr; int ret; /* initialize an attribute to default value */ ret = pthread_condattr_init(&cattr); pshared PTHREAD_PROCESS_PRIVATE pshared cattr opaque cattr PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_PRIVATE pthread_condattr_destroy(3c) pthread_condattr_init() opaque pthread_condattr_init pthread_condattr_init() ENOMEM : EINVAL : cattr pthread_condattr_destroy(3c) 4 103

104 pthread_condattr_destroy int pthread_condattr_destroy(pthread_condattr_t *cattr); #include <pthread.h> pthread_condattr_t cattr; int ret; /* destroy an attribute */ ret = pthread_condattr_destroy(&cattr); pthread_condattr_destroy pthread_condattr_destroy() EINVAL : cattr pthread_condattr_setpshared(3c) pthread_condattr_setpshared int pthread_condattr_setpshared(pthread_condattr_t *cattr, int pshared); #include <pthread.h> pthread_condattr_t cattr; int ret;

105 /* all processes */ ret = pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED); /* within a process */ ret = pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_PRIVATE); pshared PTHREAD_PROCESS_SHARED Solaris mutex_init() USYNC_PROCESS pshared PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE Solaris cond_init() USYNC_THREAD PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_SHARED pthread_condattr_setpshared pthread_condattr_setpshared() EINVAL : cattr pshared pthread_condattr_getpshared(3c) cattr pshared pthread_condattr_getpshared int pthread_condattr_getpshared(const pthread_condattr_t *cattr, int *pshared); #include <pthread.h> pthread_condattr_t cattr; int pshared; 4 105

106 int ret; /* get pshared value of condition variable */ ret = pthread_condattr_getpshared(&cattr, &pshared); PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_PRIVATE pthread_condattr_getpshared pthread_condattr_getpshared() EINVAL : cattr pthread_cond_init 108 pthread_cond_wait 109 pthread_cond_signal 111 pthread_cond_timedwait 113 pthread_cond_reltimedwait_np 114 pthread_cond_broadcast 116 pthread_cond_destroy pthread_cond_init(3c) cv pthread_condattr_init()

107 pthread_cond_init int pthread_cond_init(pthread_cond_t *cv, const pthread_condattr_t *cattr); #include <pthread.h> pthread_cond_t cv; pthread_condattr_t cattr; int ret; /* initialize a condition variable to its default value */ ret = pthread_cond_init(&cv, NULL); /* initialize a condition variable */ ret = pthread_cond_init(&cv, &cattr); cattr NULL cattr NULL Solaris 209 cond_init PTHREAD_COND_INITIALIZER PTHREAD_COND_INITIALIZER null pthread_cond_init() pthread_cond_init pthread_cond_init() EINVAL : cattr EBUSY : 4 107

108 EAGAIN : ENOMEM : pthread_cond_wait(3c) mp cv Solaris 211 cond_wait pthread_cond_wait int pthread_cond_wait(pthread_cond_t *cv,pthread_mutex_t *mutex); #include <pthread.h> pthread_cond_t cv; pthread_mutex_t mp; int ret; /* wait on condition variable */ ret = pthread_cond_wait(&cv, &mp); pthread_cond_signal() pthread_cond_broadcast() pthread_cond_wait() pthread_cond_wait()

109 pthread_cond_wait() pthread_cond_wait() pthread_cond_wait() while() pthread_mutex_lock(); while(condition_is_false) pthread_cond_wait(); pthread_mutex_unlock(); pthread_cond_wait() pthread_cond_wait pthread_cond_wait() EINVAL : cv mp cv pthread_cond_signal(3c) Solaris 213 cond_signal pthread_cond_signal int pthread_cond_signal(pthread_cond_t *cv); #include <pthread.h> pthread_cond_t cv; int ret; 4 109

110 /* one condition variable is signaled */ ret = pthread_cond_signal(&cv); pthread_cond_wait() SCHED_OTHER pthread_cond_signal() 4 8 pthread_cond_wait() pthread_cond_signal() pthread_mutex_t count_lock; pthread_cond_t count_nonzero; unsigned count; decrement_count() { pthread_mutex_lock(&count_lock); while (count == 0) pthread_cond_wait(&count_nonzero, &count_lock); count = count - 1; pthread_mutex_unlock(&count_lock); increment_count() { pthread_mutex_lock(&count_lock); if (count == 0) pthread_cond_signal(&count_nonzero);

111 4 8 pthread_cond_wait() pthread_cond_signal() count = count + 1; pthread_mutex_unlock(&count_lock); pthread_cond_signal pthread_cond_signal() EINVAL : cv 4 8 pthread_cond_wait() pthread_cond_signal() pthread_cond_timedwait(3c) pthread_cond_wait() abstime pthread_cond_timedwait() pthread_cond_timedwait int pthread_cond_timedwait(pthread_cond_t *cv, pthread_mutex_t *mp, const struct timespec *abstime); #include <pthread.h> #include <time.h> pthread_cond_t cv; pthread_mutex_t mp; timestruct_t abstime; int ret; /* wait on condition variable */ 4 111

112 ret = pthread_cond_timedwait(&cv, &mp, &abstime); pthread_cond_timewait() pthread_cond_timedwait() Solaris 211 cond_timedwait pthread_cond_timedwait() pthread_cond_timedwait() 4 9 pthread_timestruc_t to; pthread_mutex_t m; pthread_cond_t c;... pthread_mutex_lock(&m); to.tv_sec = time(null) + TIMEOUT; to.tv_nsec = 0; while (cond == FALSE) { err = pthread_cond_timedwait(&c, &m, &to); if (err == ETIMEDOUT) { /* timeout, do something */ break; pthread_mutex_unlock(&m); pthread_cond_timedwait pthread_cond_timedwait()

113 EINVAL : cv abstime ETIMEDOUT : abstime 4 9 pthread_cond_reltimedwait_np(3c) pthread_cond_timedwait() pthread_cond_reltimedwait_np() pthread_cond_reltimedwait_np int pthread_cond_reltimedwait_np(pthread_cond_t *cv, pthread_mutex_t *mp, const struct timespec *reltime); #include <pthread.h> #include <time.h> pthread_cond_t cv; pthread_mutex_t mp; timestruct_t reltime; int ret; /* wait on condition variable */ ret = pthread_cond_reltimedwait_np(&cv, &mp, &reltime); pthread_cond_reltimedwait_np() pthread_cond_reltimedwait_np() Solaris cond_reltimedwait(3c) pthread_cond_reltimedwait_np() 4 113

114 pthread_cond_reltimedwait_np() pthread_cond_reltimedwait_np pthread_cond_reltimedwait_np() EINVAL : cv reltime ETIMEDOUT : reltime cv pthread_cond_broadcast(3c) pthread_cond_wait() pthread_cond_broadcast int pthread_cond_broadcast(pthread_cond_t *cv); #include <pthread.h> pthread_cond_t cv; int ret; /* all condition variables are signaled */ ret = pthread_cond_broadcast(&cv); pthread_cond_broadcast() Solaris 213 cond_broadcast pthread_cond_broadcast() pthread_cond_broadcast() pthread_cond_broadcast()

115 4 10 pthread_mutex_t rsrc_lock; pthread_cond_t rsrc_add; unsigned int resources; get_resources(int amount) { pthread_mutex_lock(&rsrc_lock); while (resources < amount) { pthread_cond_wait(&rsrc_add, &rsrc_lock); resources -= amount; pthread_mutex_unlock(&rsrc_lock); add_resources(int amount) { pthread_mutex_lock(&rsrc_lock); resources += amount; pthread_cond_broadcast(&rsrc_add); pthread_mutex_unlock(&rsrc_lock); add_resources() resources pthread_cond_broadcast() 4 115

116 pthread_cond_wait() pthread_cond_broadcast pthread_cond_broadcast() EINVAL : cv pthread_cond_destroy(3c) cv Solaris 210 cond_destroy pthread_cond_destroy int pthread_cond_destroy(pthread_cond_t *cv); #include <pthread.h> pthread_cond_t cv; int ret; /* Condition variable is destroyed */ ret = pthread_cond_destroy(&cv); pthread_cond_destroy pthread_cond_destroy() EINVAL : cv

117 pthread_cond_signal() pthread_cond_broadcast() pthread_cond_signal() pthread_cond_broadcast() pthread_cond_wait() pthread_cond_signal() pthread_cond_broadcast() 4 11 (less) (more) 4 11 typedef struct { char buf[bsize]; int occupied; int nextin; int nextout; pthread_mutex_t mutex; 4 117

118 4 11 pthread_cond_t more; pthread_cond_t less; buffer_t; buffer_t buffer; 4 12 buffer pthread_cond_wait() pthread_cond_wait() less less pthread_cond_wait() 4 12 less pthread_cond_wait() more pthread_cond_signal() 4 12 void producer(buffer_t *b, char item) { pthread_mutex_lock(&b->mutex); while (b->occupied >= BSIZE) pthread_cond_wait(&b->less, &b->mutex);

119 4 12 assert(b->occupied < BSIZE); b->buf[b->nextin++] = item; b->nextin %= BSIZE; b->occupied++; /* now: either b->occupied < BSIZE and b->nextin is the index of the next empty slot in the buffer, or b->occupied == BSIZE and b->nextin is the index of the next (occupied) slot that will be emptied by a consumer (such as b->nextin == b->nextout) */ pthread_cond_signal(&b->more); pthread_mutex_unlock(&b->mutex); assert() NDEBUG assert() assert() assert() /* now: either b->occupied

120 mutex_unlock() assert() char consumer(buffer_t *b) { char item; pthread_mutex_lock(&b->mutex); while(b->occupied <= 0) pthread_cond_wait(&b->more, &b->mutex); assert(b->occupied > 0); item = b->buf[b->nextout++]; b->nextout %= BSIZE; b->occupied--; /* now: either b->occupied > 0 and b->nextout is the index of the next occupied slot in the buffer, or b->occupied == 0 and b->nextout is the index of the next (empty) slot that will be filled by a producer (such as

121 4 13 b->nextout == b->nextin) */ pthread_cond_signal(&b->less); pthread_mutex_unlock(&b->mutex); return(item); E. W. Dijkstra Dijkstra P 1 V 1 P 1 P V V 2 Dijkstra P V P prolagen proberen te verlagen V verhogen Dijkstra EWD 74 sem_wait(3rt) sem_post(3rt) Dijkstra P V sem_trywait(3rt) P

122 V sem_post(3rt) go to POSIX fork() pshared ID ID open retrieve close remove sem_open sem_getvalue sem_close sem_unlink sem_open sem_open sem_getvalue sem_close sem_unlink sem_init 125 sem_post

123 sem_wait 126 sem_trywait 127 sem_destroy sem_init(3rt) sem value sem_init int sem_init(sem_t *sem, int pshared, unsigned int value); #include <semaphore.h> sem_t sem; int pshared; int ret; int value; /* initialize a private semaphore */ pshared =0; value =1; ret = sem_init(&sem, pshared, value); pshared pshared Solaris 214 sema_init 4 123

2005 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Su

2005 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Su Java Desktop System Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. : 819 0675 10 2005 2 2005 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Sun Sun Berkeley

More information

2005 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Su

2005 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Su Linux Java Desktop System 3 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. 819 1515 10 2005 8 2005 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Sun

More information

2004 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / SunSun MicrosystemsSun

2004 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / SunSun MicrosystemsSun SAP livecache Sun Cluster Solaris OS SPARC Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. : 817 7374 10 2004 4 A 2004 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA

More information

提纲 1 2 OS Examples for 3

提纲 1 2 OS Examples for 3 第 4 章 Threads2( 线程 2) 中国科学技术大学计算机学院 October 28, 2009 提纲 1 2 OS Examples for 3 Outline 1 2 OS Examples for 3 Windows XP Threads I An Windows XP application runs as a seperate process, and each process may

More information

2004 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD University of California UNIX X/Open Company, Ltd.

2004 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD University of California UNIX X/Open Company, Ltd. Java Desktop System 2 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. : 817 7758 10 2004 9 2004 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Sun Sun

More information

Java Desktop System 呂衄盋 2 呂衄说柔

Java Desktop System 呂衄盋 2 呂衄说柔 Java Desktop System 2 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. : 817 7767 10 2004 10 2004 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Sun Sun

More information

Sun Fire V440 Server Administration Guide - zh_TW

Sun Fire V440 Server Administration Guide - zh_TW Sun Fire V440 Server 管 理 指 南 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. 650-960-1300 文 件 號 碼 :817-2818-10 2003 年 7 月, 修 訂 版 A 將 您 對 此 文 件 的 意 見 傳 送 到 :http://www.sun.com/hwdocs/feedback

More information

2005 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Su

2005 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A. Sun Sun Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Su StarSuite 8 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. 819 1344 10 2005 6 2005 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Sun Sun Berkeley BSD

More information

2 2 3 DLight CPU I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AM

2 2 3 DLight CPU I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AM Oracle Solaris Studio 12.2 DLight 2010 9 2 2 3 DLight 3 3 6 13 CPU 16 18 21 I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AMP Apache MySQL

More information

Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. 版 權 所 有 Sun Microsystems, Inc. 對 於 本 文 件 所 述 技 術 擁 有

Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. 版 權 所 有 Sun Microsystems, Inc. 對 於 本 文 件 所 述 技 術 擁 有 Sun Management Center 3.6 版 本 5 附 加 軟 體 版 本 說 明 適 用 於 Sun Fire Sun Blade Netra 及 Sun Ultra 系 統 Sun Microsystems, Inc. www.sun.com 文 件 號 碼 820-0131-10 2006 年 10 月, 修 訂 版 A 請 將 您 對 本 文 件 的 意 見 提 交 至 :http://www.sun.com/hwdocs/feedback

More information

ebook

ebook 3 3 3.1 3.1.1 ( ) 90 3 1966 B e r n s t e i n P ( i ) R ( i ) W ( i P ( i P ( j ) 1) R( i) W( j)=φ 2) W( i) R( j)=φ 3) W( i) W( j)=φ 3.1.2 ( p r o c e s s ) 91 Wi n d o w s Process Control Bl o c k P C

More information

C/C++ - 文件IO

C/C++ - 文件IO C/C++ IO Table of contents 1. 2. 3. 4. 1 C ASCII ASCII ASCII 2 10000 00100111 00010000 31H, 30H, 30H, 30H, 30H 1, 0, 0, 0, 0 ASCII 3 4 5 UNIX ANSI C 5 FILE FILE 6 stdio.h typedef struct { int level ;

More information

Sun Update Connection System Sun Microsystems, Inc Network Circle Santa Clara, CA U.S.A

Sun Update Connection System Sun Microsystems, Inc Network Circle Santa Clara, CA U.S.A Sun Update Connection System 1.0.8 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. 819 7286 10 2006 6 2006 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A.

More information

Copyright 2003 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A.. Sun ( ) Sun Berkeley BSD UNIX / X/Open Company, Ltd. Sun Sun

Copyright 2003 Sun Microsystems, Inc Network Circle, Santa Clara, CA U.S.A.. Sun ( ) Sun Berkeley BSD UNIX / X/Open Company, Ltd. Sun Sun Java Desktop System 2003 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. : 817 4573 10 2003 12 Copyright 2003 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A..

More information

W. Richard Stevens UNIX Sockets API echo Sockets TCP OOB IO C struct C/C++ UNIX fork() select(2)/poll(2)/epoll(4) IO IO CPU 100% libevent UNIX CPU IO

W. Richard Stevens UNIX Sockets API echo Sockets TCP OOB IO C struct C/C++ UNIX fork() select(2)/poll(2)/epoll(4) IO IO CPU 100% libevent UNIX CPU IO Linux muduo C++ (giantchen@gmail.com) 2012-09-30 C++ TCP C++ x86-64 Linux TCP one loop per thread Linux native muduo C++ IT 5 C++ muduo 2 C++ C++ Primer 4 W. Richard Stevens UNIX Sockets API echo Sockets

More information

Sun StorEdge 3000 系列安装、操作和维护手册 (3310)

Sun StorEdge 3000 系列安装、操作和维护手册 (3310) Sun StorEdge 3000 系 列 安 装 操 作 和 维 护 手 册 Sun StorEdge 3310 SCSI 阵 列 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. 650-960-1300 部 件 号 816-7960-11 2003 年 6 月, 修 订 版 A 有 关 本 文 档 的

More information

提纲 Classical Problems of Synchronization 1 Classical Problems of Synchronization 2 3 4

提纲 Classical Problems of Synchronization 1 Classical Problems of Synchronization 2 3 4 第 6 章 Processe Synchronization2( 进程同步 2) 中国科学技术大学计算机学院 2009 年 10 月 28 日 提纲 Classical Problems of Synchronization 1 Classical Problems of Synchronization 2 3 4 Outline Classical Problems of Synchronization

More information

ebook15-10

ebook15-10 1 0 10.1 U N I X V 7 4. 3 B S D S V R 3 P O S I X. 1 100 % 10.2 S I G S I G A B RT a b o r t S I G A L R M a l a r m V 7 1 5 S V R 4 4. 3 + B S D 31 < s i g n a l. h > 0 10. 9 k i l l 0 P O S I X. 1 D

More information

Learning Java

Learning Java Java Introduction to Java Programming (Third Edition) Prentice-Hall,Inc. Y.Daniel Liang 2001 Java 2002.2 Java2 2001.10 Java2 Philip Heller & Simon Roberts 1999.4 Java2 2001.3 Java2 21 2002.4 Java UML 2002.10

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 49 [P.51] C/C++ [P.52] [P.53] [P.55] (int) [P.57] (float/double) [P.58] printf scanf [P.59] [P.61] ( / ) [P.62] (char) [P.65] : +-*/% [P.67] : = [P.68] : ,

More information

Microsoft PowerPoint - RT0950_EliminatingRubyGILthroughHTM_Slides_ja.ppt

Microsoft PowerPoint - RT0950_EliminatingRubyGILthroughHTM_Slides_ja.ppt Ruby, Jose G. Castanos IBM Research Watson Research Center Ruby Python JIT Rubinius ytljit PyPy Fiorano HPC Ruby 1 2 (HTM) TM TM Sun Microsystems Blue Gene/Q 2012 Rock Processor Intel zec12 2012 Transactional

More information

新・解きながら学ぶC言語

新・解きながら学ぶC言語 330!... 67!=... 42 "... 215 " "... 6, 77, 222 #define... 114, 194 #include... 145 %... 21 %... 21 %%... 21 %f... 26 %ld... 162 %lf... 26 %lu... 162 %o... 180 %p... 248 %s... 223, 224 %u... 162 %x... 180

More information

Oracle Solaris Studio makefile C C++ Fortran IDE Solaris Linux C/C++/Fortran IDE "Project Properties" IDE makefile 1.

Oracle Solaris Studio makefile C C++ Fortran IDE Solaris Linux C/C++/Fortran IDE Project Properties IDE makefile 1. Oracle Solaris Studio 12.2 IDE 2010 9 2 8 9 10 11 13 20 26 28 30 32 33 Oracle Solaris Studio makefile C C++ Fortran IDE Solaris Linux C/C++/Fortran IDE "Project Properties" IDE makefile 1. "File" > "New

More information

概述

概述 OPC Version 1.6 build 0910 KOSRDK Knight OPC Server Rapid Development Toolkits Knight Workgroup, eehoo Technology 2002-9 OPC 1...4 2 API...5 2.1...5 2.2...5 2.2.1 KOS_Init...5 2.2.2 KOS_InitB...5 2.2.3

More information

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1 21 , 7, Windows,,,, : 010-62782989 13501256678 13801310933,,,, ;,, ( CIP) /,,. : ;, 2005. 11 ( 21 ) ISBN 7-81082 - 634-4... - : -. TP316-44 CIP ( 2005) 123583 : : : : 100084 : 010-62776969 : 100044 : 010-51686414

More information

ebook15-2

ebook15-2 2 U N I X 2.1 U N I X C U N I X U N I X 80 U N I X ( ) U N I X 2.2 UNIX 2.2.1 ANSI C 1989 C A N S I X 3. 159-1989 ANSI 1989 ISO/IEC 9899:1990 A N S I ( I S O ) ANSI C C UN I X C ANSI 1989 4 Plauger 1992;Kernighan

More information

untitled

untitled 1 Outline 數 料 數 數 列 亂數 練 數 數 數 來 數 數 來 數 料 利 料 來 數 A-Z a-z _ () 不 數 0-9 數 不 數 SCHOOL School school 數 讀 school_name schoolname 易 不 C# my name 7_eleven B&Q new C# (1) public protected private params override

More information

2007, Oracle / Sun Microsystems, Inc. / Sun Microsystems, Inc. FAR Federal Acquisition Regulations Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Mi

2007, Oracle / Sun Microsystems, Inc. / Sun Microsystems, Inc. FAR Federal Acquisition Regulations Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Mi Sun Studio 12 820 3035 2007 9 2007, Oracle / Sun Microsystems, Inc. / Sun Microsystems, Inc. FAR Federal Acquisition Regulations Berkeley BSD UNIX X/Open Company, Ltd. / Sun Sun Microsystems Sun Solaris

More information

新版 明解C言語入門編

新版 明解C言語入門編 328, 4, 110, 189, 103, 11... 318. 274 6 ; 10 ; 5? 48 & & 228! 61!= 42 ^= 66 _ 82 /= 66 /* 3 / 19 ~ 164 OR 53 OR 164 = 66 ( ) 115 ( ) 31 ^ OR 164 [] 89, 241 [] 324 + + 4, 19, 241 + + 22 ++ 67 ++ 73 += 66

More information

新・明解C言語入門編『索引』

新・明解C言語入門編『索引』 !... 75!=... 48 "... 234 " "... 9, 84, 240 #define... 118, 213 #include... 148 %... 23 %... 23, 24 %%... 23 %d... 4 %f... 29 %ld... 177 %lf... 31 %lu... 177 %o... 196 %p... 262 %s... 242, 244 %u... 177

More information

新版 明解C++入門編

新版 明解C++入門編 511!... 43, 85!=... 42 "... 118 " "... 337 " "... 8, 290 #... 71 #... 413 #define... 128, 236, 413 #endif... 412 #ifndef... 412 #if... 412 #include... 6, 337 #undef... 413 %... 23, 27 %=... 97 &... 243,

More information

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++;

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++; Memory & Pointer trio@seu.edu.cn 2.1 2.1.1 1 int *p int a 0x00C7 0x00C7 0x00C7 2.1.2 2 int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++; 2.1.3 1. 2. 3. 3 int A,

More information

C/C++ - 字符输入输出和字符确认

C/C++ - 字符输入输出和字符确认 C/C++ Table of contents 1. 2. getchar() putchar() 3. (Buffer) 4. 5. 6. 7. 8. 1 2 3 1 // pseudo code 2 read a character 3 while there is more input 4 increment character count 5 if a line has been read,

More information

Microsoft Word - 11.doc

Microsoft Word - 11.doc 除 錯 技 巧 您 將 於 本 章 學 到 以 下 各 項 : 如 何 在 Visual C++ 2010 的 除 錯 工 具 控 制 下 執 行 程 式? 如 何 逐 步 地 執 行 程 式 的 敘 述? 如 何 監 看 或 改 變 程 式 中 的 變 數 值? 如 何 監 看 程 式 中 計 算 式 的 值? 何 謂 Call Stack? 何 謂 診 斷 器 (assertion)? 如 何

More information

Multithreaded Programming Guide.ppt [兼容模式]

Multithreaded Programming Guide.ppt [兼容模式] 多线程编程 HUST Ke Shi Linux 系统下的多线程遵循 POSIX 标准线程接口 pthread 编写 Linux 下的多线程程序, 需要使用头文 件 pthread.h, 连接时需要使用库 libpthread.a 源文件 链接动态库 生成对象文件名 编译命令 :gcc **.c lpthread -o ** 1.2 一 POSIX 中常用函数 ( 一 ) 创建新线程 pthread_creat

More information

c_cpp

c_cpp C C++ C C++ C++ (object oriented) C C++.cpp C C++ C C++ : for (int i=0;i

More information

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc References (Section 5.2) Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 15-16, 2010 H.-T. Lin (NTU CSIE) References OOP 03/15-16/2010 0 / 22 Fun Time (1) What happens in memory? 1 i n t i ; 2

More information

新・解きながら学ぶJava

新・解きながら学ぶJava 481! 41, 74!= 40, 270 " 4 % 23, 25 %% 121 %c 425 %d 121 %o 121 %x 121 & 199 && 48 ' 81, 425 ( ) 14, 17 ( ) 128 ( ) 183 * 23 */ 3, 390 ++ 79 ++ 80 += 93 + 22 + 23 + 279 + 14 + 124 + 7, 148, 16 -- 79 --

More information

ebook15-C

ebook15-C C 1 1.1 l s ( 1 ) - i i 4. 14 - d $ l s -ldi /etc/. /etc/.. - i i 3077 drwxr-sr-x 7 bin 2048 Aug 5 20:12 /etc/./ 2 drwxr-xr-x 13 root 512 Aug 5 20:11 /etc/../ $ls -ldi /. /..... i 2 2 drwxr-xr-x 13 root

More information

第11章 可调内核参数

第11章 可调内核参数 11 11 Unix BSD 4.4 Linux sysctl Unix Linux /proc window /proc /proc/sys /proc/sys sysctl Unix root /proc/sys/vm root /proc/sys sysctl /proc/sys struct ctl_table 18274 struct ctl_tables /proc/sys struct

More information

A Preliminary Implementation of Linux Kernel Virus and Process Hiding

A Preliminary Implementation of Linux Kernel Virus and Process Hiding 邵 俊 儒 翁 健 吉 妍 年 月 日 学 号 学 号 学 号 摘 要 结 合 课 堂 知 识 我 们 设 计 了 一 个 内 核 病 毒 该 病 毒 同 时 具 有 木 马 的 自 动 性 的 隐 蔽 性 和 蠕 虫 的 感 染 能 力 该 病 毒 获 得 权 限 后 会 自 动 将 自 身 加 入 内 核 模 块 中 劫 持 的 系 统 调 用 并 通 过 简 单 的 方 法 实 现 自 身 的

More information

Go构建日请求千亿微服务最佳实践的副本

Go构建日请求千亿微服务最佳实践的副本 Go 构建 请求千亿级微服务实践 项超 100+ 700 万 3000 亿 Goroutine & Channel Goroutine Channel Goroutine func gen() chan int { out := make(chan int) go func(){ for i:=0; i

More information

How to Debug Tuxedo Server printf( Input data is: %s, inputstr); fprintf(stdout, Input data is %s, inputstr); fprintf(stderr, Input data is %s, inputstr); printf( Return data is: %s, outputstr); tpreturn(tpsuccess,

More information

Oracle Oracle Solaris Studio IDE makefile C C++ Fortran makefile IDE Solaris Linux C/C++/Fortran Oracle IDE "P

Oracle Oracle Solaris Studio IDE makefile C C++ Fortran makefile IDE Solaris Linux C/C++/Fortran Oracle IDE P Oracle Solaris Studio 12.3 IDE 2011 12 E26461-01 2 7 8 9 9 Oracle 10 12 14 21 26 27 29 31 32 33 Oracle Solaris Studio IDE makefile C C++ Fortran makefile IDE Solaris Linux C/C++/Fortran Oracle IDE "Project

More information

Microsoft Word - 01.DOC

Microsoft Word - 01.DOC 第 1 章 JavaScript 简 介 JavaScript 是 NetScape 公 司 为 Navigator 浏 览 器 开 发 的, 是 写 在 HTML 文 件 中 的 一 种 脚 本 语 言, 能 实 现 网 页 内 容 的 交 互 显 示 当 用 户 在 客 户 端 显 示 该 网 页 时, 浏 览 器 就 会 执 行 JavaScript 程 序, 用 户 通 过 交 互 式 的

More information

FY.DOC

FY.DOC 高 职 高 专 21 世 纪 规 划 教 材 C++ 程 序 设 计 邓 振 杰 主 编 贾 振 华 孟 庆 敏 副 主 编 人 民 邮 电 出 版 社 内 容 提 要 本 书 系 统 地 介 绍 C++ 语 言 的 基 本 概 念 基 本 语 法 和 编 程 方 法, 深 入 浅 出 地 讲 述 C++ 语 言 面 向 对 象 的 重 要 特 征 : 类 和 对 象 抽 象 封 装 继 承 等 主

More information

第一章 概论

第一章  概论 1 2 3 4 5 6 7 8 Linux 7.1 7.1.1 1 1 2 3 2 3 1 2 3 3 1 2 3 7.1.2 1 2 1 2 3 4 5 7.1.3 1 1 2 3 2 7.1 3 7.1.4 1 1 PCB 2 3 2 PCB PCB PCB PCB PCB 4 1 2 PSW 3 CPU CPU 4 PCB PCB CPU PCB PCB PCB PCB PCB PCB PCB

More information

前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii

前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii 前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii C# 7 More Effective C# C# C# C# C# C# Common Language Runtime CLR just-in-time

More information

C/C++ - 函数

C/C++ - 函数 C/C++ Table of contents 1. 2. 3. & 4. 5. 1 2 3 # include # define SIZE 50 int main ( void ) { float list [ SIZE ]; readlist (list, SIZE ); sort (list, SIZE ); average (list, SIZE ); bargragh

More information

chp6.ppt

chp6.ppt Java 软 件 设 计 基 础 6. 异 常 处 理 编 程 时 会 遇 到 如 下 三 种 错 误 : 语 法 错 误 (syntax error) 没 有 遵 循 语 言 的 规 则, 出 现 语 法 格 式 上 的 错 误, 可 被 编 译 器 发 现 并 易 于 纠 正 ; 逻 辑 错 误 (logic error) 即 我 们 常 说 的 bug, 意 指 编 写 的 代 码 在 执 行

More information

C/C++程序设计 - 字符串与格式化输入/输出

C/C++程序设计 - 字符串与格式化输入/输出 C/C++ / Table of contents 1. 2. 3. 4. 1 i # include # include // density of human body : 1. 04 e3 kg / m ^3 # define DENSITY 1. 04 e3 int main ( void ) { float weight, volume ; int

More information

AL-M200 Series

AL-M200 Series NPD4754-00 TC ( ) Windows 7 1. [Start ( )] [Control Panel ()] [Network and Internet ( )] 2. [Network and Sharing Center ( )] 3. [Change adapter settings ( )] 4. 3 Windows XP 1. [Start ( )] [Control Panel

More information

Chapter 9: Objects and Classes

Chapter 9: Objects and Classes Java application Java main applet Web applet Runnable Thread CPU Thread 1 Thread 2 Thread 3 CUP Thread 1 Thread 2 Thread 3 ,,. (new) Thread (runnable) start( ) CPU (running) run ( ) blocked CPU sleep(

More information

WWW PHP

WWW PHP WWW PHP 2003 1 2 function function_name (parameter 1, parameter 2, parameter n ) statement list function_name sin, Sin, SIN parameter 1, parameter 2, parameter n 0 1 1 PHP HTML 3 function strcat ($left,

More information

Kernel Kernel Kernel Kernel load estimator runqueue kernel/sched.

Kernel Kernel Kernel Kernel load estimator runqueue kernel/sched. Linux Kernel 2.6 20321131 Kernel 2.4...3 Kernel 2.4...3 Kernel 2.4...3 Kernel 2.6...3...3 1....3 2....4 3. load estimator...4 4....4 5....4...4 1....4 2. runqueue kernel/sched.c...4 3. task_struct(include/linux/sched.h)...6...9

More information

C/C++ - 字符串与字符串函数

C/C++ - 字符串与字符串函数 C/C++ Table of contents 1. 2. 3. 4. 1 char C 2 char greeting [50] = " How " " are " " you?"; char greeting [50] = " How are you?"; 3 printf ("\" Ready, go!\" exclaimed John."); " Ready, go!" exclaimed

More information

将 Win32 C/C++ 应用程序迁移到 POWER 上的 Linux, 第 2 部分 : 互斥 Nam Keung 高级程序员 IBM 2005 年 4 月 21 日 ( 最初于 2005 年 2 月 10 日 ) Chakarat Sk

将 Win32 C/C++ 应用程序迁移到 POWER 上的 Linux, 第 2 部分 : 互斥 Nam Keung 高级程序员 IBM 2005 年 4 月 21 日 ( 最初于 2005 年 2 月 10 日 ) Chakarat Sk 将 Win32 C/C++ 应用程序迁移到 POWER 上的 Linux, 第 2 部分 : 互斥 Nam Keung (mailto:namkeung@us.ibm.com) 高级程序员 IBM 2005 年 4 月 21 日 ( 最初于 2005 年 2 月 10 日 ) Chakarat Skawratananond (mailto:chakarat@us.ibm.com) pseries Linux

More information

1 LINUX IDE Emacs gcc gdb Emacs + gcc + gdb IDE Emacs IDE C Emacs Emacs IDE ICE Integrated Computing Environment Emacs Unix Linux Emacs Emacs Emacs Un

1 LINUX IDE Emacs gcc gdb Emacs + gcc + gdb IDE Emacs IDE C Emacs Emacs IDE ICE Integrated Computing Environment Emacs Unix Linux Emacs Emacs Emacs Un Linux C July 27, 2016 Contents 1 Linux IDE 1 2 GCC 3 2.1 hello.c hello.exe........................... 5 2.2............................... 9 2.2.1 -Wall................................ 9 2.2.2 -E..................................

More information

Oracle 4

Oracle 4 Oracle 4 01 04 Oracle 07 Oracle Oracle Instance Oracle Instance Oracle Instance Oracle Database Oracle Database Instance Parameter File Pfile Instance Instance Instance Instance Oracle Instance System

More information

华恒家庭网关方案

华恒家庭网关方案 LINUX V1.5 1 2 1 2 LINUX WINDOWS PC VC LINUX WINDOWS LINUX 90% GUI LINUX C 3 REDHAT 9 LINUX PC TFTP/NFS http://www.hhcn.com/chinese/embedlinux-res.html minicom NFS mount C HHARM9-EDU 1 LINUX HHARM9-EDU

More information

Microsoft Word - 物件導向編程精要.doc

Microsoft Word - 物件導向編程精要.doc Essential Object-Oriented Programming Josh Ko 2007.03.11 object-oriented programming C++ Java OO class object OOP Ruby duck typing complexity abstraction paradigm objects objects model object-oriented

More information

IP505SM_manual_cn.doc

IP505SM_manual_cn.doc IP505SM 1 Introduction 1...4...4...4...5 LAN...5...5...6...6...7 LED...7...7 2...9...9...9 3...11...11...12...12...12...14...18 LAN...19 DHCP...20...21 4 PC...22...22 Windows...22 TCP/IP -...22 TCP/IP

More information

ebook129-11

ebook129-11 11 TThread Wi n 32 16 Wi n d o w s Wi n 3 32 D e l p h i 11.1 3 Win32 API Wi n 32 C P U C P U 16 Windows 32 Delphi Delphi 1 11.1.1 16 Wi n 32 Windows 3.1 1 2 C P U 1 Windows 3.1 Wi n d o w s 16 Wi n d

More information

提问袁小兵:

提问袁小兵: C++ 面 试 试 题 汇 总 柯 贤 富 管 理 软 件 需 求 分 析 篇 1. STL 类 模 板 标 准 库 中 容 器 和 算 法 这 部 分 一 般 称 为 标 准 模 板 库 2. 为 什 么 定 义 虚 的 析 构 函 数? 避 免 内 存 问 题, 当 你 可 能 通 过 基 类 指 针 删 除 派 生 类 对 象 时 必 须 保 证 基 类 析 构 函 数 为 虚 函 数 3.

More information

untitled

untitled 1 5 IBM Intel 1. IBM 第 1/175 页 第 2/175 页 第 3/175 页 80 第 4/175 页 2. IBM 第 5/175 页 3. (1) 第 6/175 页 第 7/175 页 第 8/175 页 = = 第 9/175 页 = = = = = 第 10/175 页 = = = = = = = = 3. (2) 第 11/175 页 第 12/175 页 第 13/175

More information

Open topic Bellman-Ford算法与负环

Open topic   Bellman-Ford算法与负环 Open topic Bellman-Ford 2018 11 5 171860508@smail.nju.edu.cn 1/15 Contents 1. G s BF 2. BF 3. BF 2/15 BF G Bellman-Ford false 3/15 BF G Bellman-Ford false G c = v 0, v 1,..., v k (v 0 = v k ) k w(v i 1,

More information

Microsoft PowerPoint - os_4.ppt

Microsoft PowerPoint - os_4.ppt 行 程 資 科 系 林 偉 川 行 程 概 念 行 程 與 程 式 主 要 的 不 同 點 : 程 式 是 被 放 在 外 部 的 儲 存 裝 置 如 磁 碟 上, 而 行 程 則 被 放 在 記 憶 體 中 程 式 在 儲 存 裝 置 中 是 靜 態 的, 而 行 程 在 記 憶 體 中 是 動 態 的, 它 會 隨 著 一 些 事 件 的 發 生 而 產 生 相 對 的 改 變 行 程, 就 是

More information

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 Java V1.0.1 2007 4 10 1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 6.2.10 6.3..10 6.4 11 7.12 7.1

More information

WebSphere Studio Application Developer IBM Portal Toolkit... 2/21 1. WebSphere Portal Portal WebSphere Application Server stopserver.bat -configfile..

WebSphere Studio Application Developer IBM Portal Toolkit... 2/21 1. WebSphere Portal Portal WebSphere Application Server stopserver.bat -configfile.. WebSphere Studio Application Developer IBM Portal Toolkit... 1/21 WebSphere Studio Application Developer IBM Portal Toolkit Portlet Doug Phillips (dougep@us.ibm.com),, IBM Developer Technical Support Center

More information

D C 93 2

D C 93 2 D9223468 3C 93 2 Java Java -- Java UML Java API UML MVC Eclipse API JavadocUML Omendo PSPPersonal Software Programming [6] 56 8 2587 56% Java 1 epaper(2005 ) Java C C (function) C (reusability) eat(chess1,

More information

ebook15-12

ebook15-12 1 2I / O 12.1 I / O V I / O s e l e c tp o l l r e a d vw r i t e v I / Om m a p 14 15 12.2 I / O 1 0. 5 F I F O F I F O i o c t l 14 I / O I / o p e n, r e a dw r i t e I / O (1) o p e n O _ N O N B L

More information

软件测试(TA07)第一学期考试

软件测试(TA07)第一学期考试 一 判 断 题 ( 每 题 1 分, 正 确 的, 错 误 的,20 道 ) 1. 软 件 测 试 按 照 测 试 过 程 分 类 为 黑 盒 白 盒 测 试 ( ) 2. 在 设 计 测 试 用 例 时, 应 包 括 合 理 的 输 入 条 件 和 不 合 理 的 输 入 条 件 ( ) 3. 集 成 测 试 计 划 在 需 求 分 析 阶 段 末 提 交 ( ) 4. 单 元 测 试 属 于 动

More information

IC-900W Wireless Pan & Tilt Wireless Pan & Tilt Remote Control / Night Vision FCC ID:RUJ-LR802UWG

IC-900W Wireless Pan & Tilt Wireless Pan & Tilt Remote Control / Night Vision FCC ID:RUJ-LR802UWG IC-900W Wireless Pan & Tilt Wireless Pan & Tilt Remote Control / Night Vision FCC ID:RUJ-LR802UWG --------------------------------------------TABLE OF CONTENTS------------------------------------------

More information

全国计算机技术与软件专业技术资格(水平)考试

全国计算机技术与软件专业技术资格(水平)考试 全 国 计 算 机 技 术 与 软 件 专 业 技 术 资 格 ( 水 平 ) 考 试 2008 年 上 半 年 程 序 员 下 午 试 卷 ( 考 试 时 间 14:00~16:30 共 150 分 钟 ) 试 题 一 ( 共 15 分 ) 阅 读 以 下 说 明 和 流 程 图, 填 补 流 程 图 中 的 空 缺 (1)~(9), 将 解 答 填 入 答 题 纸 的 对 应 栏 内 [ 说 明

More information

untitled

untitled Work Managers 什 Work Managers? WebLogic Server 9.x 行 (thread) 理 thread pool 數量 立 execute queues 來 量 理 thread count, thread priority 參數 理 thread pool 數量? WebLogic Server 9.x 理 行 (thread) (self-tuning) 句

More information

untitled

untitled 1 行 行 行 行.NET 行 行 類 來 行 行 Thread 類 行 System.Threading 來 類 Thread 類 (1) public Thread(ThreadStart start ); Name 行 IsAlive 行 行狀 Start 行 行 Suspend 行 Resume 行 行 Thread 類 (2) Sleep 行 CurrentThread 行 ThreadStart

More information

目录

目录 ALTERA_CPLD... 3 11SY_03091... 3 12SY_03091...4....5 21 5 22...8 23..10 24..12 25..13..17 3 1EPM7128SLC.......17 3 2EPM7032SLC.......18 33HT46R47......19..20 41..20 42. 43..26..27 5151DEMO I/O...27 52A/D89C51...28

More information

第7章-并行计算.ppt

第7章-并行计算.ppt EFEP90 10CDMP3 CD t 0 t 0 To pull a bigger wagon, it is easier to add more oxen than to grow a gigantic ox 10t 0 t 0 n p Ts Tp if E(n, p) < 1 p, then T (n) < T (n, p) s p S(n,p) = p : f(x)=sin(cos(x))

More information

Microsoft PowerPoint - ch6 [相容模式]

Microsoft PowerPoint - ch6 [相容模式] UiBinder wzyang@asia.edu.tw UiBinder Java GWT UiBinder XML UI i18n (widget) 1 2 UiBinder HelloWidget.ui.xml: UI HelloWidgetBinder HelloWidget.java XML UI Owner class ( Composite ) UI XML UiBinder: Owner

More information

sp_overview.pptx

sp_overview.pptx 系統程式設計 Systems Programming 鄭卜壬教授臺灣大學資訊工程系 Tei-Wei Kuo, Chi-Sheng Shih, Hao-Hua Chu, and Pu-Jen Cheng 2008 Goal of SP Course You are expected. to be familiar with the UNIX-like systems to become good system

More information

ME3208E2-1.book

ME3208E2-1.book DocuPrint 205/255/305 操 作 說 明 書 Adobe Adobe logo PostScript PostScript 3 及 PostScript logo 是 Adobe Systems Incorporated 的 商 標 Microsoft Windows Windows NT Windows Server 是 美 國 Microsoft Corporation 於 美

More information

科学计算的语言-FORTRAN95

科学计算的语言-FORTRAN95 科 学 计 算 的 语 言 -FORTRAN95 目 录 第 一 篇 闲 话 第 1 章 目 的 是 计 算 第 2 章 FORTRAN95 如 何 描 述 计 算 第 3 章 FORTRAN 的 编 译 系 统 第 二 篇 计 算 的 叙 述 第 4 章 FORTRAN95 语 言 的 形 貌 第 5 章 准 备 数 据 第 6 章 构 造 数 据 第 7 章 声 明 数 据 第 8 章 构 造

More information

TX-NR3030_BAS_Cs_ indd

TX-NR3030_BAS_Cs_ indd TX-NR3030 http://www.onkyo.com/manual/txnr3030/adv/cs.html Cs 1 2 3 Speaker Cable 2 HDMI OUT HDMI IN HDMI OUT HDMI OUT HDMI OUT HDMI OUT 1 DIGITAL OPTICAL OUT AUDIO OUT TV 3 1 5 4 6 1 2 3 3 2 2 4 3 2 5

More information

C 1

C 1 C homepage: xpzhangme 2018 5 30 C 1 C min(x, y) double C // min c # include # include double min ( double x, double y); int main ( int argc, char * argv []) { double x, y; if( argc!=

More information

ebook14-4

ebook14-4 4 TINY LL(1) First F o l l o w t o p - d o w n 3 3. 3 backtracking parser predictive parser recursive-descent parsing L L ( 1 ) LL(1) parsing L L ( 1 ) L L ( 1 ) 1 L 2 L 1 L L ( k ) k L L ( 1 ) F i r s

More information

Microsoft Word - PHP7Ch01.docx

Microsoft Word - PHP7Ch01.docx PHP 01 1-6 PHP PHP HTML HTML PHP CSSJavaScript PHP PHP 1-6-1 PHP HTML PHP HTML 1. Notepad++ \ch01\hello.php 01: 02: 03: 04: 05: PHP 06:

More information

untitled

untitled 3 C++ 3.1 3.2 3.3 3.4 new delete 3.5 this 3.6 3.7 3.1 3.1 class struct union struct union C class C++ C++ 3.1 3.1 #include struct STRING { typedef char *CHARPTR; // CHARPTR s; // int strlen(

More information

LSI U320 SCSI卡用户手册.doc

LSI U320 SCSI卡用户手册.doc V1.0 Ultra320 SCSI SCSI 2004 7 PentiumIntel MS-DOS Windows Novell Netware Novell Sco Unix Santa Cruz Operation LSI U320 SCSI SCSI SCSI Integrated Mirroring/Integrated Striping BIOS Firmware LSI U320 SCSI

More information

1. 访 问 最 新 发 行 公 告 信 息 jconnect for JDBC 7.0 1. 访 问 最 新 发 行 公 告 信 息 最 新 版 本 的 发 行 公 告 可 以 从 网 上 获 得 若 要 查 找 在 本 产 品 发 布 后 增 加 的 重 要 产 品 或 文 档 信 息, 请 访

1. 访 问 最 新 发 行 公 告 信 息 jconnect for JDBC 7.0 1. 访 问 最 新 发 行 公 告 信 息 最 新 版 本 的 发 行 公 告 可 以 从 网 上 获 得 若 要 查 找 在 本 产 品 发 布 后 增 加 的 重 要 产 品 或 文 档 信 息, 请 访 发 行 公 告 jconnect for JDBC 7.0 文 档 ID:DC74874-01-0700-01 最 后 修 订 日 期 :2010 年 3 月 2 日 主 题 页 码 1. 访 问 最 新 发 行 公 告 信 息 2 2. 产 品 摘 要 2 3. 特 殊 安 装 说 明 2 3.1 查 看 您 的 jconnect 版 本 3 4. 特 殊 升 级 指 导 3 4.1 迁 移 3

More information

Microsoft PowerPoint - OS5.ppt

Microsoft PowerPoint - OS5.ppt Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems Oct-03 1 Process Concept An operating system

More information

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2 (Guangzhou) AIT Co, Ltd 020-84106666 020-84106688 http://wwwlenxcn Xi III Zebra XI III 1 (Guangzhou) AIT Co, Ltd 020-84106666 020-84106688 http://wwwlenxcn 230V 110V [ ]! 2 (Guangzhou) AIT Co, Ltd 020-84106666

More information

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha CYPOK CYPOK 1 UltraEdit Project-->Install Language Tool: Language Suite----->hi-tech picc Tool Name ---->PICC Compiler Executable ---->c:hi-picinpicc.exe ( Command-line Project-->New Project-->File Name--->myc

More information

Chapter 2

Chapter 2 2 (Setup) ETAP PowerStation ETAP ETAP PowerStation PowerStation PowerPlot ODBC SQL Server Oracle SQL Server Oracle Windows SQL Server Oracle PowerStation PowerStation PowerStation PowerStation ETAP PowerStation

More information

C/C++ 语言 - 循环

C/C++ 语言 - 循环 C/C++ Table of contents 7. 1. 2. while 3. 4. 5. for 6. 8. (do while) 9. 10. (nested loop) 11. 12. 13. 1 // summing.c: # include int main ( void ) { long num ; long sum = 0L; int status ; printf

More information

Windows XP

Windows XP Windows XP What is Windows XP Windows is an Operating System An Operating System is the program that controls the hardware of your computer, and gives you an interface that allows you and other programs

More information

普 通 高 等 教 育 十 二 五 重 点 规 划 教 材 计 算 机 系 列 中 国 科 学 院 教 材 建 设 专 家 委 员 会 十 二 五 规 划 教 材 操 作 系 统 戴 仕 明 姚 昌 顺 主 编 姜 华 张 希 伟 副 主 编 郑 尚 志 梁 宝 华 参 编 参 编 周 进 钱 进

普 通 高 等 教 育 十 二 五 重 点 规 划 教 材 计 算 机 系 列 中 国 科 学 院 教 材 建 设 专 家 委 员 会 十 二 五 规 划 教 材 操 作 系 统 戴 仕 明 姚 昌 顺 主 编 姜 华 张 希 伟 副 主 编 郑 尚 志 梁 宝 华 参 编 参 编 周 进 钱 进 科 学 出 版 社 普 通 高 等 教 育 十 二 五 重 点 规 划 教 材 计 算 机 系 列 中 国 科 学 院 教 材 建 设 专 家 委 员 会 十 二 五 规 划 教 材 操 作 系 统 戴 仕 明 姚 昌 顺 主 编 姜 华 张 希 伟 副 主 编 郑 尚 志 梁 宝 华 参 编 参 编 周 进 钱 进 参 编 北 京 内 容 简 介 本 书 由 浅 入 深 系 统 全 面 地 介 绍

More information

epub83-1

epub83-1 C++Builder 1 C + + B u i l d e r C + + B u i l d e r C + + B u i l d e r C + + B u i l d e r 1.1 1.1.1 1-1 1. 1-1 1 2. 1-1 2 A c c e s s P a r a d o x Visual FoxPro 3. / C / S 2 C + + B u i l d e r / C

More information

EJB-Programming-4-cn.doc

EJB-Programming-4-cn.doc EJB (4) : (Entity Bean Value Object ) JBuilder EJB 2.x CMP EJB Relationships JBuilder EJB Test Client EJB EJB Seminar CMP Entity Beans Session Bean J2EE Session Façade Design Pattern Session Bean Session

More information

C语言的应用.PDF

C语言的应用.PDF AVR C 9 1 AVR C IAR C, *.HEX, C,,! C, > 9.1 AVR C MCU,, AVR?! IAR AVR / IAR 32 ALU 1KBytes - 8MBytes (SPM ) 16 MBytes C C *var1, *var2; *var1++ = *--var2; AVR C 9 2 LD R16,-X ST Z+,R16 Auto (local

More information

Microsoft Word - linux命令及建议.doc

Microsoft Word - linux命令及建议.doc Linux 操 作 系 统 命 令 集 1 基 本 命 令 查 看 系 统 信 息 : uname -a 修 改 密 码 : passwd 退 出 : logout(exit) 获 取 帮 助 : man commands 2 文 件 和 目 录 命 令 显 示 当 前 工 作 目 录 : pwd 改 变 所 在 目 录 : cd cd - 切 换 到 上 一 次 使 用 的 目 录 cd 切 换

More information