Describe the difference between a Thread and a Process?
A process is essentially a program being executed – a set of instructions that will make use of different resources (I/O devices, CPU etc) in order to produce some output. In turn every process is made up of one or more threads, each handling a stream of instructions within the process.
At the simplest level a process will consist of one thread which is called the main thread of execution. The main difference to note is that whereas every process running on a system will have its own independent memory address space, threads will make use of the same (identical) address space used by the process. Moreover threads will also share the context (state information) of their parent process in addition to their own unique context. Although threads are attached to a particular process they are still independent from each other. And due to this independence threads, like different processes, can be run on different CPUs. Thus a performance gain can be noticed when using a multi-threaded application on a multi-processor system.
In conclusion it can be summarized that threads assist a process in carrying out its primary task, whereas processes (in most cases) are completely separate tasks. In order to illustrate this take for example your favourite email client. If the email client had been developed without using threads you would only be able to perform one task at a time. So for instance you wouldn’t be able to receive new email whilst writing a new email as execution is carried out in a sequential order.

What is a Windows Service and how does its lifecycle differ from a “standard” EXE?
A Windows Service is in itself an application. However such an application does not have any user interface and is executed as a background process which requires no user intervention whatsoever. As the names implies these applications offer essential services (such as Administrative Alerts and DNS Resolution) to other processes and thus require that they are constantly running.
Windows Services exist throughout the time an operating system is running, thus their lifetime is equal to the lifetime of the OS. Once the OS is booted the services are automatically loaded and thus do not even require that a user is logged in. However, having said that Windows Services can still be started paused and stopped. This lifecycle is handled by the service manager which uses a messaging system to interact with the services’ process. It is also important to note that one process may provide many services; a Windows Service is not a one-to-one mapping to a process. For example svchost.exe offers various services such as the DHCP Client, HTTP SSL and Automatic Updates Services.

What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
Every process on a Windows system has access to a 4GB address space, the maximum virtual memory of the system, of which the top 2GB are reserved for use by Windows whilst the lower 2GB are available to the application. Since every process runs on the same system the top 2GB are identical for all the processes.
It is important to note that the above is true for 32-bit systems where the virtually memory manager uses 32-bit addressing. When 64-bit addressing is used a process can address 16 terabytes of memory with 8 terabytes reserved for the kernel and 8 terabytes for the application. (Note: in theory 64-bit systems should address 16 exabytes = 16,000 petabytes = 16,000,000 terabytes, however the 64-bit Windows implementation is limited to 16 terabytes)
This limitation must be taken in consideration for applications that will make use of more then 2GB (or 8 terabytes in 64-bit systems) of memory. In such cases it would be required that the application implements its own memory management techniques.

What is the difference between an EXE and a DLL?
Although an EXE file and a DLL file are both executables, a DLL file cannot execute on its own. A DLL file is a dynamic link library which is referenced by an EXE during program runtime and dynamically loaded into memory. As its name implies a DLL is a library, a library of functions. The advantage of using DLL’s is that commonly used functions such as graphics and printing functions can be packaged into a common DLL which is then referenced by different executables without having to re-write the functions. In addition, these libraries are dynamic in that are only loaded in memory when they are called. For instance if an application references a printing DLL but during the lifetime of that application the user never prints, the DLL will not be loaded in memory.

What is strong-typing versus weak-typing? Which is preferred? Why?
In strong-types languages it is required that the type of every variable is explicitly defined and which will be further enforced by the semantics of the language. In simpler terms an operation will not succeed on operand of different types.
On the other hand in weak-typed languages the type of a variable can vary between compile-time and run-time. For example 1 + “a” is valid in VB as 1 will be converted to a string.
Which is preferred of the two is subject to opinion. Developers in favor of weak-typing will argue that weak-types languages provide faster coding (as it is not required to explicitly declare your variables) and more flexibility. On the other hand developers favoring strong-typing will argue that strong-typed language allow for interoperability (as is the case with the Common Types System in .NET) and for improved security.

Corillian’s product is a “Component Container.” Name at least 3 component containers that ship now with the Windows Server Family.
Component Containers are EXEs that host DLLS (components). These include:
W3wp.exe: The IIS (Internet Information Services) worker process that handles requests for web sites and applications within an application pool.
Aspnet_wp.exe: This process handles the majority of the processing required by ASP.Net applications.
Dllhost.exe: As its name implies this process acts as a container (host) for an DLL’s that need to be loaded.
Svchost.exe: The Microsoft Service Host process hosts services that are executed from with DLL’s.
Rundll32.exe: This process allows for the execution of DLL’s.

What is a PID? How is it useful when troubleshooting a system?
PID stands for Process Identifier. This is a unique system wide number that identifies a process on the system. This ID is used by debuggers and low-level administrative tools to indicate which process is causing the problem. It can also be used to trace system calls of a particular process.

How many processes can listen on a single TCP/IP port?
This depends on what type of binding has been used. If a process binds exclusively to an interface and port then no other process has access to it. On the other hand if a process uses non-exclusive binding then other processes can also use the port. It is important to note that binding of a port is paired to an interface, so if a system has multiple interfaces different processes can bind on the same port but different interfaces simultaneously.

What is the GAC? What problem does it solve?
GAC refers to the Global Assembly Cache. This system wide cache comes with the .NET Common Language Runtime. This cache is used to share assemblies (formerly know as DLLs) that are to be used by several applications.
The GAC solves the problem commonly known as DLL Hell whereby applications using the same DLL would override the DLL with newer versions which would in turn cause problems in the application using the older version of the DLL. The GAC solves this by using versioning: each assembly (DLL) requires version information to be included and enforced in order that an application would know which version to reference.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s