Skip to main content
留学咨询

辅导案例-CS 531

By May 15, 2020No Comments

CS 531: Fundamentals of Systems Programming Spring 2020 Instructor: Hal Greenwald Homework 3 sample output As discussed in class, the parent process should ignore SIGINT (Ctrl+C) while the child process is active. The child should allow SIGINT to behave in its default manner. Remember also, to reinstate the parent’s SIGINT behavior to its original state (not default state) prior to function completion. Homework 3 sample output: Test 1: $ ./hw3 “ping 127.0.0.1” PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.049 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.121 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.055 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.118 ms ^C — 127.0.0.1 ping statistics — 4 packets transmitted, 4 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.049/0.086/0.121/0.034 ms Parent process is sleeping… $ Test 2: $ ./hw3 “ps -a” PID TTY TIME CMD 5925 ttys000 0:00.03 login -pf halgreenwald 5926 ttys000 0:00.46 -bash 5934 ttys001 0:00.02 login -pf halgreenwald 5935 ttys001 0:00.82 -bash 24790 ttys002 0:00.04 login -pf halgreenwald 24791 ttys002 0:00.28 -bash 50596 ttys002 0:00.00 ./hw3 ps -a 50597 ttys002 0:00.00 ps –a Parent process is sleeping… $ Test 3: In terminal window # 1: $ ./hw3 “ping 127.0.0.1” PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.049 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.121 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.055 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.118 ms In terminal window # 2: ls-iMac:cs531 halgreenwald$ “ps -a” PID TTY TIME CMD 5925 ttys000 0:00.03 login -pf halgreenwald 5926 ttys000 0:00.51 -bash 54312 ttys000 0:00.00 ps -a 54310 ttys002 0:00.00 ./hw3 ping 127.0.0.1 54311 ttys002 0:00.00 ping 127.0.0.1 In terminal window # 2: Hals-iMac:cs531 halgreenwald$ kill -STOP 54311 Terminal window # 1 should show: 64 bytes from 127.0.0.1: icmp_seq=84 ttl=64 time=0.045 ms 64 bytes from 127.0.0.1: icmp_seq=85 ttl=64 time=0.123 ms 64 bytes from 127.0.0.1: icmp_seq=86 ttl=64 time=0.041 ms stopped by signal 17 Then from terminal window # 2: Hals-iMac:cs531 halgreenwald$ kill -CONT 54311 Window # 1 starts back up: 64 bytes from 127.0.0.1: icmp_seq=87 ttl=64 time=0.045 ms 64 bytes from 127.0.0.1: icmp_seq=88 ttl=64 time=0.123 ms 64 bytes from 127.0.0.1: icmp_seq=89 ttl=64 time=0.041 ms

admin

Author admin

More posts by admin