Tuesday, December 30, 2008

C and Linux programming


Writing and Using libraries:

Virtually all programs are linked against one or more libraries. Any program that uses a C functin (such as printf or malloc) will be linked against the C runtime library. If your program has a GUI, it will be linked against windowing libraries.

We need to decide whether to link the library statically or dynamically. If we choose to link statically, program will become bigger in size and harder to upgrade, but probabyly easier to deploy. If we link dynamically, programs will be smaller, easier to upgrade, but harder to deploy.

Archives:

archive (or static library) - Simply a collection of object files stored in a single file. When we provide an archive to the linker, the linker searches the archive for the object files it needs, extracts them and links them into your program

archive can be created using ar command. archive files uses .a extension.

to combine test1.0 and test2.o and make a single archive libtest.a

=> ar cr libtest.a test1.o test2.o

the cr flags tesll ar to create the archive. Now we can link with this archive using the -ltest option with gcc or g++

When the linker encounters an archive on the command line, it searches the archive for all definitions of symbols (functions or variables) that are referenced from hte object files that it has already processed but not yet defined. The object files that define those symbols are extracted from the archive and included in the final executable.

Shared libraries:

Shared library (also known as shared object , or as dynamically linked library) - similar to archive in that it is a grouping of object files. However, there are many important differences. The most fundamental difference is that when a shared library is linked into a program, the final executable does not actually conbtain the code that is present in the shared library. Instead, the executable merely contains a reference to the shared library. If several programs on the system are linked against the same shared library they will all reference the library, but non will actually be included. Thus the library is 'shared' among all the programs that link with it.

Another important difference is that a shared library is not merely a collection of object files, out of which the linker chooses those that are needed to satisfy undefined references. Instead, the object files that compose the shared library are combined into a single object file so that a program that links against a shared library always includes all of the code in the library, rather than just those portions that are needed.

To create shared library, we mush compile the objects that will make up the library using the -fPIC option to the compiler as shown below

=> gcc -c -fPIC test1.c

the -fPIC options tells the compiler that you are going to be using test.o as part of a shared object.

PIC - stands for Position Independent Code. The functions in shared library may be loaded at different addresses in different programs, so the code in teh shared object must not depend on the address (or position) at which it is loaded.

to combine hte object files into a shared library

=>gcc -shared -fPIC -o libtest.so test1.0 test2.0

-shared option tells the compiler to produce a shared library rather than an ordinary executable. Shared libraries use the extension .so, which stands for shared object.Like static archives the name always begins with lib to indicate that the file is a library.

linking with a shared library is just like linking with a static archive. For example, the following line will link with libtest.so if it is in the current directory or one of the standard library search directories on the system

=> gcc -static -o app app.o -L, -ltest

the ldd command displays the shared libraries that are linked into an executable. These libraries need to be available when the executable is run.

using LD_LIBRARY_PATH

When we link a program with shared library, the linker does not put the full path to the shared library in the resulting executable. Instead, it places only the name of the shared library. When the program is actually run, the system searches for teh shared library and loads it. The system searches only/lib and /usr/lib, by default. If a shared library that is linked into your program is installed outside of those directories, it will not be found, and the system will refuse to run the program.

One solution to this problem is to use the -Wl, -rpath option when linking the program.

=> gcc -o app app.o -L, -ltest -Wl, -rpath, /usr/local/lib

in this case, when app is run, the system will search /usr/local/lib for any required shared libraries.

Another solution is, to set the LD_LIBRARY_PATH environment variable when running the program. like PATH variable, LD_LIBRARY_PATH is a colon-separated list of directories. For ex, if LD_LIBRARY_PATH is /usr/local/lib:/opt/lib, then those directories will be searched before standard /lib and /usr/lib directories.

Pros and Cons:

Shared libraries :

- Saves the space. If the same library is referenced by many programs, we can save lot of space by linking with shared libraries.

- Upgrading is easy. If we upgrade library, all the programs referencing that library are upgraded

Static Libraries:

- If we want to upgrade only one program referencing the library, then static library is good.

- If we are not going to install the library in /lib or /usrlib then shared library is not suitable as each user of the program has to set the LD_LIBRARY_PATH properly.

Dynamic Loading and Unloading:

For loading some code at run time without explicitly linking in that code. (ex: Plug-in)

We can load the library libtest.so by using dlopen in linux

dlopen ("libtest.so", RTLD_LAZY)

The second parameter is a flag that indicates how to bind symbols in the shared library.

To use dynamic loading functions, include /dlfcn.h/ and link with the -ldl option to pick up the libdl library

dlclose unloads the shared library.

Error codes for system calls:

System call return zero if operation succeeds, or a non zero value if the operation fails.

Most system calls use a special variable named errno to store additional information in case of failure. When a call fails, the system sets errno to a value indicating what went wrong. All system calls use the same variable. So we need to copy that variable into another variable immediately after the failed call. The value of errno will be overwritten the next time you make a system call.

Error values are integers; possible values are given by prepocesor macros, by convention named in all capitals and starting with "E" - for example, EACCESS and EINVAL.

include the /errno.h/ in the header to use errno

strerror - returns a character string description of an errno error code. include /string.h/

perror - prints the error description directly to the stderr stream. Pass to perror a char string prefix to print before the error description, which is usally name of the function. include /stdio.h/


ex:

main(){

int fd;

fd = open("inputfile.txt, O_RDONLY);

if (fd ==1)

fprintf(stderr, "Error opening file : %s\n",strerror(errno));

exit(1);

}

prints:

Error opening file : No such file or directory

EINTR: error code set during interrupts / when the I/O is blocked.


System call failures:

System calls can fail in many ways, for example:



- The system can run out of resources (or the program can exceed the resource limits enforced by the system of a single program). For example, the program might try to allocate too much memory, to write too much to a disk, or to open too many files at the same time.



- Linux may block a certain system call when a program attempts to perform an operation for which it does not have permission. For example, a program might attempt to write to a file marked read-only, to access the memory of another process, or to kill another user's program.



- The arguments to a system call might be invalid, either because the user provided invlid input or because of program bug. For instance, the program might pass an invalid memory address or an invalid file descriptor to a system call. Or a program might attempt to open a directory as an ordinary file, or might pass the name of an ordinary file to a system call that expects a directory.



- A system call can fail for reasons external to program like accessing faulty device or not supported device for I/O



- A system call can be some times interrupted by the external event, such as delivery of signal.



Using assert:

assert macro is the simplest method to check for unexpectd conditions in the standard C. The argment to this macro is boolean expression. The program is terminated if the expression evaluates to false, after printing a error message containing the source file and line number and the text of the expression.



This is very useful for a variety of consistency checks internal to a program. assert can be used to test the validity of function arguments, to test preconditions and post conditions of function calls and to test for unexpected return values.



For performance critical code, runtime checks such as assert can impose significant performance penalty. In these cases, we can compile the code with the NDEBUG macro defined, by using -DNDEBUG flag on compiler command line. With NDEBUG set, the code of assert macro will be taken away. So we ned to be careful while putting the code in the assert macro. We should not call functions inside assert expressions, assign variables, or use modifying paramets such as ++.



Assert can be used in places such as



- Check against the NULL pointer, {assert (pointer !=NULL);}

The error message generated will be "Assertion 'pointer != ((void * )0)' failed"... This is better for debugging than the normal error "Segmentation fault (core dumped)"



- Check condition on function parameter values. For ex; if a function can take only + value for parameter user assert (i >0);





temp files:

mkstemp() - creates a unique temporary file from the file name template, create the file with permissions for current user and opens the file for read/write. The file name teamplate is a character string ending with "XXXXXX" (6 capital X); mkstemp replaces the X's with characters so that the file name is unique. The return value is a file descriptor.



temporory files created with mkstemp are not deleted automatically. It's upto us to remove the temp file when it is not needed.





#include /sdtio.h/

#include /unistd.h/



int write_temp_file (char *buffer, size_t length)

{

char temp_filename[] = "/tmp/temp_file.XXXXXX"

int fd = mkstemp(temp_filename);

/* unlink the file immediately, so that it will be removed when the file descriptor is closed */

unlink(temp_filename);

write(fd, &length, sizeof(length); /* writes number of bytes */

write(fd, buffer, lentgh); /* writes data */

return fd;

}





/* Reading the data from tmp file */



char* read_temp_file(int temp_file, size_t* length)

{

char *buffer;

int fd = temp_file;

lseek(fd, 0, SEEK_SET); /* Rewind to the begining of the file */

read(fd, length, sizeof(*length)); /*Read the size of data in temp file*/

buffer = (char*) malloc(*length);

read (fd, buffer, *length);

close (fd); /* this will cause the temp file to go away */

return buffer;

}





If we don't need to pass the temporary file to another program we can use tmpfile instead of mkstemp



printing the environment:

#include /stdio.h/



/* The ENVIRON variable contains the environment information. This variable of type char**, is a NULL terminated array of pointers to character strings. */



extern char **environ;



int main() {

char **var;

for (var = environ; *var !=NULL; ++var)

printf ("%s\n", *var);

return 0;

}



use setenv, unsetenv functions to set and clear the environment variables.





Exit Codes:

We can obtain the exit code of a most recently executed program using the $? variable



echo $? will give the exit code of recently executed program



In C++,

endl - token flushes a stream in addition to printing a new line character.

\n - will not flush the stream.





stdout, stderr:
Stdout is buffered. data written to stdout is not send to the console until the buffer fills. We can explicitly flush the buffer by calling the following

fflush (stdout);

In contrast, stderr is not buffered; data written to stderr goes directly to the console;

this loop doesn't print the # every second, instead the #s are buffered and bunch of them are printed when the buffer fills.

while(1) {
printf("#");
sleep(1);
}

In the below loop, the # is printed once a second

while(1) {
fprintf(stderr, "#");
sleep(1);
}




Simple Sorting:

#include

using namespace std;

#define maxsize 100


int main()

{

int temp, i, j, n, list[maxsize];

cout<<"\nEnter your list size: "; cin>>n;

// prompting the data from user and store it in the list...

for(i=0; i";

cin>>list[i];

}



// do the sorting...

for(i=0; i list[j])

{

// these three lines swap the elements list[i] and list[j].

temp = list[i];

list[i] = list[j];

list[j] = temp;

}

cout<<"\nSorted list, ascending: "; for(i=0; i
cout<<" "<
cout<
return 0;

}

Sunday, March 2, 2008

Evolution of cellular technologies

Welcome to our 2nd article on Cellular Fundamentals.
In this article let's look at the evolution of some of the key technologies.

In 1947 Bell Laboratories introduced the idea of cellular communications with police car technology. Since then, it is undergoing many changes, overcoming many obstacles and reached its current state. It is in 1982 the FCC (Federal Communications Commission) in USA approved the first commercial cellular service called AMPS (Advanced Mobile Phone Service) and allocated frequencies around 824-894MHz. This is called the First Generation (1G) of cellular service. (One point to note here is similar to computers technology where we have many generations of computers; in mobiles also we have generations like 1G, 2G, 2.5G, 3G, 4G etc.,. The later generations have many more features and they are very advanced ones compared to the earlier generations. We will explain these whenever we come across in our articles).

Do you know who made the first mobile phone? Motorola made the first commercially available mobile phone. Martin Cooper, a Motorola employee placed a call to his rival who is head of research at AT&T’s Bell Labs at the time. Sometimes having rivals is very important to do some historical things in life.

As I mentioned, cellular technology underwent many changes and many new technologies came up as the time passes. They have different specifications like channel spacing (means how much bandwidth is allocated for each user), access technology (how multiple users can access the system simultaneously) and they offer different levels of capabilities. Let’s take a look at those in the below table


Though there are many technologies as shown in the table, there are only 3 groups driving these technologies.
- 3GPP (3rd Generation Partnership Project) - which defines the specifications


for GSM technology line,
- 3GPP2 (3rd Generation Partnership Project 2) - which defines the specifications


for CDMA technology line
- IEEE 802 (Institute of Electrical and Electronics Engineers) – A group under


IEEE which defines the standards for LAN (Local Area Networks) and MAN


(Metropolitan Area Networks). In current context, this group delivers the


standards for the WiMAX technology.

Now let’s quickly summarize the technology lines so that we can remember them easily.

GSM --> GPRS -->EDGE -->UMTS -->HSDPA -->HSUPA -->LTE

cdmaOne --> CDMA 1x --> CDMA 1x EV-DO -->CDMA 1x EV-DV

wLAN -->WiMAX --> More to come in future

As we saw here, there are many wireless technologies that exist today and many are coming up in future..

Let’s stop our discussion on evolution here.. and start with the CDMA.

CDMA (code division multiple access) itself is not a communication protocol. It is just a multiple access technique. cdmaOne is the brand name of the first cellular communication protocol standard which uses CDMA. The first specification was made as IS-95A (Interim Standard made in the year 1995). A is to indicate that this is the first in that series. This standard supports voice and very low data rates up to 14.4kbps. The next version IS95-B supports voice and data rates up to 115kbps. Please make a note that for any technology, data rates indicated are the peak data rates. In practice, the average data rate is much lower than the data rate indicated.

CDMA 1x system doubles the voice capacity of the cdmaOne system and also supports high-speed data rates. The peak data rate supported is 153kbps. The reason for having 1x in the name is to indicate that this system uses one 1.25MHz channel. There were some works on using CDMA 3x which uses three 1.25 MHz channels to support more users and more data rates. But the invention of other advanced technologies put a full stop to this work. So we are left with 1x only.


You might be wondering why we thought of CDMA, when the GSM is already in place. The reason is to provide more data rates to users. As we saw in the table, GSM is based on TDMA and it uses a 200 KHz channel that is divided in to 8 time slices giving each user a bandwidth of 25 KHz. This bandwidth is not sufficient for many data applications. This made the technologists across world to look for an alternative technology that provides support for higher capacity and high data rate applications. Hence, we got the CDMA.

Another question that may come into your mind may be why 1.25MHz?

The answer is simple. The initial communication standard AMPS used 25MHz band. In which 12.5 MHz for Uplink and 12.5 MHz for Downlink. When CDMA was developing Qualcomm (Note: Qualcomm is the pioneer who developed CDMA and holds many patents in this technology) claimed 10% increase in capacity and spectrum usage when compared to AMPS. So they started developing on 1.25MHz.

Get yourself familiar with some jargon:

Forward Channel – Is the channel from the BTS to the mobile phone. As the BTS controls and governs the communication, it broadcast the information and guides the mobile for proper communication. That’s why this channel is called Forward Channel (In GSM this is called Downlink as the mobile is receiving information from the BTS on this channel)

Reverse Channel – Is the channel from mobile phone to the BTS. Mobile always responds to the control information from BTS and it obeys whatever BTS says. So the channel from mobile to BTS is called as Reverse channel. (In GSM this is called Uplink as mobile sends information on this channel)


In our next article, let’s discuss about the different codes and channels used in CDMA and their significance.

Monday, February 18, 2008

Making the Foundation


Welcome.

Let’s make a good and solid foundation for understanding the cellular communication. We believe this is very much needed before we dwell into any of the technology.

Billions of humans (I didn’t see any animal using it) use mobile phone today. But very few know what is inside, how it works, how the hell my voice is reaching the other party, how I can connect to inter’net’ without any physical connection. For many, this may not be of interest. They are much interested in cool mobile designs, typing and forwarding the funny smses etc.. But we, as technical people and being in this wireless (I never said worth less) industry should know how the system works? What are the building blocks? So let’s start..

Telecommunication by definition is a system for transmitting the information over a distance electronically. In case of wire line communications, this is done with the help of electric signals. In case of wireless communication, this is achieved by Electro Magnetic Waves.

The basic elements of a telecommunication system are
- A transmitter (Tx) – that takes information and converts it to signal
- A transmission medium – that carries the signal
- A receiver – that receives the signal and converts it back to the usable information.

When you make a call using your mobile phone, your phone is the transmitter and the big towers (which we can see on top of some buildings) act as a receiver. When you receive a call, these towers act as transmitter and your phone is now a receiver. In technical terms this tower is called as BTS (Base Transceiver System). The word transceiver is because it can work as both transmitter and receiver. These BTSs belong to some operator like Airtel, Reliance, BSNL etc.,

Having said about the transmitter and receiver, let’s look at the third and most important element of the communication system – the transmission medium. In wireless communication RF signals are used to transmit the information over the air. Let’s see it in the electromagnetic spectrum


The RF spectrum lies in the frequency range of 3Hz – 300GHz. This is divided into many sub bands like low frequency, medium frequency, high frequency, very high frequency, super high frequency…… huh…etc.,

The frequency band used for mobile phones is the UHF band which ranges from 300-3000 MHz. Some wireless technologies like wireless LAN uses the frequency in the range of 5GHz.

People cannot use this frequency for their own use freely. Government controls and sells the license to use these frequencies. Operators like Airtel, reliance buy the license from government by paying lot of money. As this is of very high cost, the operator want to use this frequency very effectively, efficiently. They try to accommodate more and more users in the frequency band they bought. Also the frequency band is limited. So this is a scarce and very costly resource in cellular communication. All the technologies that we are going to talk later came up to do this job more and more efficiently.

Now let’s look at in what manner the BTSs are placed over a region. It is as shown in the below figure.

The basic geographical unit served by one BTS is called cell. (That’s why it is called cellular communication system). The total geographical area is divided into number of cells. A group of cells is called a cluster. The shape of coverage area of one BTS is shown as a hexagon shape but in reality due to the constraints of the geographic terrain, the actual shape is not hexagon.

Now, one can ask a question why hexagon shape is selected to represent a cell?
The answer is, when we arrange the cells uniformly over the region, it should cover whole of the geographic area, and at the same time, we should minimize the overlapping area between the cells. If we have the large overlapping area, then we need more base stations to cover the total area. In general when we use the Omni directional antenna, the BTS coverage region is circular in shape. So there are three possible shapes to represent this. See the below figure.


In the overlap region the mobile phone switches from one BTS to other BTS. This is called hand over in technical terms. This is a complex process and should be minimized in the cellular system. So to minimize the overlap region and to cover the area with minimum BTSs the Hexagon shape is the only possible shape to represent the cell.

Now, let’s go back and discuss a bit on the cluster. Why this is important to know?
In FDMA, and TDMA we differentiate users based on frequency and time slots respectively. So in a cluster, if we use the same frequency in the neighbor cells, then there is a interference between the users in the two cells because both are using same frequency. (Here we are not mentioning about time slots because, when we use different frequency, obviously we can differentiate the time slots on two different frequencies).

To put in simple terms, let’s assume that two group of students are sitting side by side and one teacher for each group in the middle, delivering some science lesson. When both teachers start the lesson in the same language, same pitch etc., the students cannot follow the teacher because of interference from the other teacher’s lesson.
Now let’s say if in the two groups, one group is normal students and a teacher, and the other group consists of deaf and dump students and teacher. Now when the teachers start the lessons the students can follow easily in their own way.

Similarly in cellular systems, to avoid this interference problem we cannot use the same frequency in the neighbor cell. Then? How many different frequencies we should buy? No problem, because the frequencies can be reused in other clusters. So to summarize in FDMA and TDMA we cannot use the same frequency for different cells in a cluster, but we can re use the frequency in different clusters. This is called frequency reuse and it is denoted by frequency reuse factor. In the GSM this factor is 1/7 (7 is because the cluster consists of 7 cells).

Now, let’s discuss about how it is decided that which frequencies to use in cellular communication and other services, who decides it and how it is decided.

As we already mentioned frequency is a finite resource and can accommodate a limited number of simultaneous users at one time. Due to this reason, the governments divide the radio spectrum into non-overlapping blocks. And then different blocks are allocated to different class of services for example broadcast services (TV,radio etc), military services (Defense related services), mobile services (for the commercial mobile communication purpose) etc., I have put some important services and their frequencies in the below table.



Note: As you can see from the above table, the frequency bands used for cellular communication are 824-849 & 869 – 894MHz which is well known as 800 MHz band and 1850-1910 and 1930-1990 MHz which is well known as 1900 MHz band in cellular communication.


These allocations can be specific for each country. But due to the fact that radio signal propagation do not stop at national boundaries, if there is no coordination between countries it may lead to dangerous situations. Want to know some examples?

Assume that some frequency xHz is allocated for some defense communication by Indian government. And our neighbor country doesn’t know about it or they know but they don’t care and they allocated the same xHz frequency for some mobile operator. Now with this, that mobile operator can easily decode Indian defense communication signals legally in his country. Don’t you think it is a danger?

To avoid this some standard bodies like ITU (International Telecommunication Union) are formed which regulates the frequency allocations for different class of services in different regions. All countries governments should agree and follow the regulations made by the ITU for the use of frequency for different services. ITU regulatory body meets once in every two years to review the regulations, add /modify any class of services etc., and to take necessary actions.

Apart from ITU which governs this process at international level, there is a regulatory body in every country to do frequency allocation for different services, for different operators etc.,
In India we have TRAI (Telecom Regulatory Authority of India) for this purpose. TRAI allocates frequencies and they sell the licenses to use the frequency bands for different operators like Airtel, Reliance etc., Again because there are few frequencies and many operators, this selling is done by auction.

Now you might be wondering why AM radio / TV takes those initial range of frequencies? why not other frequencies? Any specific technical reason? The answer is No. It is just evolution, whenever some new class of service comes people allocate the next available frequency band. AM Radio came first.. so it took the initial range of frequencies, then TV and then Cell Phone etc..


This is pretty much about the frequency allocation, frequency reuse etc., that I wanted to share with you. In our next article.. we will discuss about the evolution of different RF technologies like GSM, CDMA etc., and their technology lines, what frequencies they use and some basic concepts of modulation techniques..



Tuesday, February 5, 2008

CDMA - Prologue

This is a prologue to a series of articles we are planning to write here on CDMA. The articles basically take one from the basics of CDMA to advanced stages of the technology like Ev-Do etc. We are couple of people writing the articles here, and you may find a bit of difference in the style of writing in these articles. Let's start the journey.

I remember one of my friend who is really good in java and related technologies once asking me "what is this CDMA phone and GSM phone and how different they are. As both phones are transmitting through air gets sound to my ear :), would there be lot different the way they work?". Sounded to me quite right :). But the point here is, if a techie geek like him doesn't know much about CDMA, I felt lot many people also who are new to the IT and telecom industry may not know much about it. Hence, thought of starting this category in this blog. In this blog, we are planning to write a series of articles which would serve as a tutorial for CDMA that may be helpful for people who are newcomers to this field.

CDMA - Code Division Multiple Access

CDMA is a technology that gets used in one type of Cellular system for communication over the air. This is one of the technologies that gets used in your cell phones for the communication. Let's look at what exactly the name CDMA relates to.

The full form of CDMA - Code Division Multiple Access. As the name contains "Multiple Access", it gives a clue that this is something to do with accessing something by a multiple things. Let's see what these “things” are. These things are basically, the air interface communication channel and multiple users using it for communication. In a nutshell, the communication channel is shared by multiple users, by using some Codes that will divide this channel into multiple unique channels that are relevant only to that particular user.

There are some more multiple access techniques which are also widely used. They are TDMA (Time division Multiple Access) and FDMA (Frequency division Multiple Access).

Following is a crude analogy to understanding all these three techniques.

Let’s go back to our childhood, where we used to take some plastic PVC pipes to talk to a friend on the other side.

Similarly, let’s say we have a big plastic pipe through which people on the both ends talk to each other to communicate.

TDMA : Time Division Multiple Access

This is the technique, where each person would be allocated some time slot to talk through the pipe. Once, his timeslot is over, the chance will go to the next user. The first user needs to wait for his next turn. Here, each user is limited by the amount of time he has been allotted. Total number of users that can use this pipe is limited by the number of time slots we have. In actual TDMA also, each user is allocated a predefined time slot to use the air interface.

FDMA: Frequency Division Multiple Access

This is the technique, where, there are some small pipes that are inserted into the big pipe. Each small pipe can be used by each user without any limit on the time. But each user is limited by the lesser size of the pipe. Total number of users that can use this pipe is limited by the number of smaller pipes that can fit in. In actual FDMA, each user is allocated a frequency out of a frequency band, which is like the smaller pipe that we talked about.

CDMA: Code Division Multiple Access

Here, each user talks in different languages in the same pipe at the same time. Each person uses a unique language that can be understood by only by his pair on the other end. Hence, there wouldn’t be any problem to the other pair of people. Here, the users can use the whole pipe without any limit due to the time slot etc. But, here the users are limited by the noise created. If there are three pairs talking to each other at the same time. The noise levels might not be high and each person can listen to their counterpart properly. If number of users increase, then the noise level can go high and can create lot of interference. Hence, in CDMA, the users are limited by the noise levels. In actual CDMA, each user is assigned a unique secret code, using which it communicates to the other side.

FDMA and TDMA are used together used in GSM cellular systems. CDMA is used in CDMA cellular systems. So, if you have a GSM phone/service, that will be using FDMA and TDMA techniques to access the air interface, whereas if it’s a CDMA phone, it uses CDMA technique to access the air interface.

The next article talks about why someone invented CDMA when TDMA and FDMA were already ruling the space. Any big advantages of CDMA over the other technologies? The next article also gives a taste of what kinds of codes we use in CDMA etc. So ..stay glued.