CURRENT ISSUE
Contests
Test your eq
|
|
Issue #230 September 2009
Problem 1—Given the FIFO data structure defined below, can you write thread-safe functions to initialize the FIFO, add an item to it, remove an item from it, and find out how many items are in the FIFO? How many items can you put into this FIFO?
#define FIFO_SIZE 100
typedef struct {
unsigned int head;
unsigned int tail;
int data[FIFO_SIZE];
} FIFO;
void fifo_init (FIFO *f);
unsigned int fifo_count (FIFO *f);
void fifo_add (FIFO *f, int item);
int fifo_remove (FIFO *f);
Problem 2—Suppose you add a "full" flag to the data structure, as shown below. How many items can you store in the FIFO now, and what do the thread-safe access functions look like?
typedef struct {
unsigned int head;
unsigned int tail;
bool full;
int data[FIFO_SIZE];
} FIFO;
Problem 3 —To a first approximation, what is the voltage gain of a common-emitter or common-base transistor amplifier?
Problem 4 —What is the voltage gain of a common-collector transistor amplifier?
|