Шукаєте відповіді та рішення тестів для [BasicOS] Fundamentals in Operating Systems (APVRILLE, Ludovic)? Перегляньте нашу велику колекцію перевірених відповідей для [BasicOS] Fundamentals in Operating Systems (APVRILLE, Ludovic) в moodle.eurecom.fr.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
Check all the true claims about the result of the stat command given below.
--
$ stat test File: test Size: 8811 Blocks: 24 IO Block: 4096 regular fileDevice: fd01h/64769d Inode: 22814078 Links: 1Access: (0644/-rw-r--r--) Uid: ( 8003/apvrille) Gid: ( 105/soc_staff)Access: 2022-09-16 18:10:22.641433749 +0200Modify: 2022-09-16 18:10:22.625433571 +0200Change: 2022-09-16 18:10:22.625433571 +0200 Birth: -\end{lstlisting}
Processors usually have two executions modes: the kernel mode, and the user mode. Check all the true claims among the following ones.
Check all the true claims about the communication between processes.
Check all the true claims about malloc().
Check the memory sections of processes containing memory dynamically allocated during run time
The following code is taken from the ipc/msg.c file of the Linux Kernel 4.19.225. Check all the true claims that follow.
/** * newque - Create a new msg queue * @ns: namespace * @params: ptr to the structure that contains the key and msgflg * * Called with msg_ids.rwsem held (writer) */static int newque(struct ipc_namespace *ns, struct ipc_params *params){ struct msg_queue *msq; int retval; key_t key = params->key; int msgflg = params->flg; msq = kvmalloc(sizeof(*msq), GFP_KERNEL); if (unlikely(!msq)) return -ENOMEM; msq->q_perm.mode = msgflg & S_IRWXUGO; msq->q_perm.key = key; msq->q_perm.security = NULL; retval = security_msg_queue_alloc(&msq->q_perm); if (retval) { kvfree(msq); return retval; } msq->q_stime = msq->q_rtime = 0; msq->q_ctime = ktime_get_real_seconds(); msq->q_cbytes = msq->q_qnum = 0; msq->q_qbytes = ns->msg_ctlmnb; msq->q_lspid = msq->q_lrpid = NULL; INIT_LIST_HEAD(&msq->q_messages); INIT_LIST_HEAD(&msq->q_receivers); INIT_LIST_HEAD(&msq->q_senders); /* ipc_addid() locks msq upon success. */ retval = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni); if (retval < 0) { ipc_rcu_putref(&msq->q_perm, msg_rcu_free); return retval; } ipc_unlock_object(&msq->q_perm); rcu_read_unlock(); return msq->q_perm.id;}
Check all the true claims about brk() and malloc(). To help you, we provide the manul page of brk() below.
--
BRK(2) Linux Programmer's Manual BRK(2) brk() and sbrk() change the location of the program break, which defines the end of the process's data segment (i.e., the program break is the first location after the end of the uninitialized data segment). Increasing the program break has the brk() sets the end of the data segment to the value specified by addr, when that value is reasonable, the system has enough sbrk() increments the program's data space by increment bytes. Calling sbrk() with an increment of 0 can be used to find On success, sbrk() returns the previous program break. (If the break was increased, then this value is a pointer to the Avoid using brk() and sbrk(): the malloc(3) memory allocation package is the portable and comfortable way of allocating memory. The return value described above for brk() is the behavior provided by the glibc wrapper function for the Linux brk() system call. (On most other implementations, the return value from brk() is the same; this return value was also specified in SUSv2.) However, the actual Linux system call returns the new program break on success. On failure, the system call re‐ turns the current break. The glibc wrapper function does some work (i.e., checks whether the new break is less than addr) On Linux, sbrk() is implemented as a library function that uses the brk() system call, and does some internal bookkeeping so This page is part of release 4.16 of the Linux man-pages project. A description of the project, information about reporting Linux 2016-03-15 BRK(2)
The following program has a memory allocation issue. At which loop index will our program generate a segmentation fault?
#include <stdlib.h>#include <stdio.h>int main(int argc, char ** argv) { char *name; long long i; name = (char *) (malloc (20 * sizeof (char))); for(i=0; i>-1; i++) { name[i] = (char)i; printf("i=%lld\n", i); } }
Does this program always provoke a segmentation fault?
#include <stdlib.h>int main(int argc, char ** argv) { char *name; name = (char *) (malloc (20 * sizeof (char))); name[22] = 'h';}
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!