Motivations to use concurrent machines

1- What are the motivations to use concurrent machines?
2- Define the following terms:
a. Task, describe the five different states in which a task can be.
b. synchronization
c. competition and cooperation synchronization
d. Race condition
3- Define semaphore, what is Guard? Give an example of a semaphore
4- How is deadlock related to liveness?
5- Suppose two tasks, A and B, must use the shared variable Buf_Size. Task A adds 2 to
Buf_Size, and task B subtracts 1 from it. Assume that such arithmetic operations are done
by the three-step process of fetching the current value, performing the arithmetic, and
putting the new value back. In the absence of competition synchronization, what
sequences of events are possible and what values result from these operations? Assume
that the initial value of Buf_Size is 6.
6- LL parsers: for the following grammar
S → A b
A → ( b a b )
| ( A b )
| b
a. Find first and follow
b. Construct LL(1) parse table
c. Is this an LL(1) grammar? Why or why not?
7- Show a complete LR(0) and SLR(1) parsers, including the canonical collection of LR(0)
and parsing table, using the following grammar
E → E + T / T
T → T F / F
F → F *
| a
| b
Is this grammar LR(0) or SLR(1)? Why?
Practical Questions:
8- Write appropriate Lex programs for the following tasks:

Count number of letters and digits in the input string.
Count the occurrences of your name in the input string.
9- Write appropriate YACC + Lex programs for the following tasks:
Program to recognize strings of the form cat, bat, rat, hat, etc. which means that
the grammar would be of the form “[LETTER]at”. [LETTER] would be any
single letter from a-z.
Let’s say you are developing a desktop application where your name would be
treated as the username. Write a program to recognize the string of your name
only. Any other string except your name would result in an error printed on the