Copyright Notice: Copyright by CMPUT 379, U. of Alberta, course instructor (E. Elmallah). All rights reserved. Do not post any part on a publicly-available Web site.
Question 1 (v4) [20 points]
1.1 (a) True/False: on a CPU designed to run Unix, a program running in the user (un-
privileged) mode can not read the CPU interrupt mask bits?
Copyright By PowCoder代写 加微信 powcoder
(b) True/False: on a CPU designed to run Unix, a program running in the user (un-
privileged) mode can not define an interrupt handling routine for any I/O device? Briefly explain your answer.
1.2 In Unix, executing open(· · · ) to open a user owned file may fail. Write at least two possible reasons for such a failure. Write a C code fragment to print an error message explaining the reason of failure, if the call fails.
1.3 True/False: a process using sigaction() can arrange for the signal handler to identify the PID of the sender process? If false, explain why such a feature is not supported. If true, explain the main steps needed to make such an arrangement (identify the place the PID may be found). Recall that POSIX sigaction environment uses the following C structs (some details are omitted):
struct sigaction {
int sa_flags;
sigset_t sa_mask;
void (*sa_sigaction)
struct siginfo {
int si_signo;
pid_t si_pid;
uid_t si_uid;
void *si_addr;
(int, siginfo_t *, void *);
1.4 In Unix, the following time values are measured by an external monitor for a process that forks a child. The child exits first. The parent exits later without waiting for
the child. Assume that the parent calls function clock t times (struct tms once before exiting and prints only the values in buf.
Parent process
Started: Mon, Mar 7, 2022 9:00:00 AM real: 0m2.000s
user: 0m0.700s
system: 0m0.100s
Child process
Started: Mon, Mar 7, 2022 9:00:00 AM real: 0m0.100s
user: 0m0.050s
system: 0m0.030s
(a) What numerical values are expected in the parent’s output?
(b) If the values are not accurate, what can be done to make them more accurate?
University of Alberta examination University of Alberta examination
University of Alberta examination
University of Alberta examination University of Alberta examination
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com