Draw flowcharts for the following tasks:Calculate area of a rectangle area = base heightFind Cube of a Number Calculate Marks Percentage (marks obtained / total marks) 100Calculate Sales Tax amount (tax percent / 100)
A formula is ________ if it is true in all interpretations
A. Unsatisfiable
B. Entailed
C. Semantically equivalent
D. Satisfiable
E. Valid
A linux kernel develepor decides to simplify the seqlock and replaces the counter with a boolean variable, set to true (1) when a writer enters its critical section and reset to false (0) when the writer leaves its critical section. To the developer’s surprise, the kernel began to occasionally malfunction, causing the system to crash.
• What do you think the problem is in the simplification that might cause the kernel to malfunction? • How does the use of a counter fix it and is there any scenario under which even the counter might fail to properly synchronize the readers and writers (i.e., what are the assumptions under which the counter-based implementation works)?
(b) Monitors allow safe sharing of abstract data types among concurrent processes by ensuring that only one process can execute (any code that manipulates the shared data) within the monitor at any given time. In order to allow a process to wait on a condition from within a monitor, condition variables are implemented as follows: when p0 signals a condition while p1 is waiting on it, p0 continues to execute; p1 is merely woken up from the corresponding wait and allowed to compete for re-entry to the monitor when p0 exits the monitor. What implications does this implementation have on the semantics someone using this style of monitor can assume?
. Synchronization and deadlocks:
(a)
Consider a data type called bank account, defined by the following:
typedef struct {
unsigned SSN;
float balance;
semaphore mutex;
} bankaccount;
Suppose we have a set of such accounts. Suppose further that a function Find Account exists that, when called with an unsigned argument, returns a pointer to the record containing an SSN (the key) equal to the argument, and NULL if no such record exists. You may assume that at most one record (bank account) exists for each unique SSN. The following procedure named Debit takes two SSNs, subtracts the specified amount (a float argument) from the first account if the balance is greater than or equal to the requested amount, and adds it to the second.
Consider a server with two clients running independent multi-threaded databases. Client 1 has paid for 75% of the available CPU resources, while Client 2 has paid for 25%. How would you ensure that each client got their requested (paid for) share of CPU resource?
Consider a server with two clients running independent multi-threaded databases. Client 1 has paid for 75% of the available CPU resources, while Client 2 has paid for 25%. How would you ensure that each client got their requested (paid for) share of CPU resource?
1. Preparation for theory-based questions which can be asked during interview.
1.1 Linked List vs 1-d Array
1.2 Comparison of Singly Linked List, doubly linked list and circular Linked list. Advantages and disadvantages of each.
1. What is indexed addressing mode?Explain and show diagrams?
2.what is base indexed addressing mode? Explain and show diagrams?
3.what is base indexed plus displacement addressing mode? Explain and show diagrams?