Q1. Compare and contrast what information is stored in PCBs in Linux and Microsoft’s Windows XP, and how both manage processes? What process states are defined by each of these Operating Systems?

The process control block in operating system can be considered to a data structure that is used to store information that is directly related to the process in the kernel. It is very important to know about the process control block as it is mostly accessed by the utilities of the operating system. There are basically three common parts of process control block that are process identification data, process state data and process control data. Digging deep in to the structure of process control block, in general it can be further divided into more different parts that are Process State, Process ID, CPU registers, Accounting information, CPU scheduling, I/O status information, memory management information and CPU scheduling information.

Now moving towards the structure of a process control block in Linux, we come to know that it is mainly divided into three categories that are Process Identity, Process Environment and Process Context. The process identity in process control block is further divided into three parts that are Process ID, Credentials and Personality. Every process in the process control block contains an ID that is used to specify the process and some additional identifiers in order to find out the tress of the process initialized by the user. Moreover there is need of groups IDs to determine the rights of the process when it comes to access the system files and resources.  The third part is the personality that is used when there is need to modify the semantics of system call. The process environment on the other hand is the one that inherits its properties from its parents and it divided into further two vectors that are argument and environment vectors. The process context is further divided into more different parts that are scheduling context, accounting, fill table, file system context, single handler table and virtual memory context.

On the other hand in Windows XP, the processes are managed by the Process Manager rather than Process Control Block like in Linux. The process manager in Windows XP is responsible for the creation of process; it also deletes the processes and uses process as well. It also creates the threads and jobs. The process states that are defined by Process Manager in Windows XP are Execution context, program code, resources and associated threads.  Another difference between the process control blocks and Process Manager is that the relationships and hierarchies of processes are controlled by environmental subsystem that own the process are managed by Process Manager. While these tasks are handled by Process Control Blocks in Linux. Moreover process scheduling is not handled by process manager, while the scheduling of thread s is handled by kernel dispatcher. Whenever a process is created in Windows XP it contains one or more threads. In windows XP a new thread is created as a new process is started, the threads in term send an execution call to the asynchronous procedure call. The asynchronous procedure calls and the queuing that are sent to the threads are managed by the process manager in the Windows XP however the scheduler is handled by the process control block in Linux. The reason that the system used asynchronous procedure call is that so that it can execute a thread, attach debuggers, complete I/O and then terminate the threads and processes.

 

Q2. Research how threads are implemented in Windows XP and Linux. Compare and contrast the implementation. How do these implementations differ from POSIX threads.

Thread is very efficient programming technique that is good for sharing the files that are open such other resources at the same time. With threads it is possible to execute multiple threads in a shared memory address space. The threads also allows the programmers to deal with concurrent programming however on the other hand, if there are multiple processors, then it can be considered as the best true example of parallel programming. The threads in Linux are implemented in a very different way as compare to the ones in Windows XP. In Linux threads are considered to be the processes only and there is absence of threads when it comes to the Linux Kernel. When there is need of duplication in Linux then fork() can be used to duplicate a process completely. The reason is that there is no structure in Linux Kernel to present the threads. In this way, the concept of a thread is converted into a simple process that however matches the properties of a thread that is it can share files and resources with other going on processes as well. However if we talk about the threads in Linux, then we come to know that it also has a unique structure, but for the kernel of Linux it is just as another process like other processes. On the other hand, in Linux the threads are considered only a way to share resources with other process. It is entirely different from the concept of threads in Windows XP. Let us consider an example to understand the concept of threads in Linux, if there is a process that is containing three threads then it means that there are chances of the presence of a process descriptor which performs that tasks for the identification of shared resources that may be open files or the address spaces. In simple words it can be said that there are four processes that exist in Linux and thus four structures for threads as well.

There are threads for executable code in Windows XP. While talking about threads in Windows XP, there are one or more than one threads when a process is started in Windows XP. The threads in Windows XP are supported by Win32 API that is used for one-to-one threading;  however in case of many to many models there is also fiber library that is provided by Win 32 API. There are certain properties that each thread in Windows XP has; the properties are process affinity, CPU-usage information, scheduling state and actual priority. While talking about thread in Windows XP, there are six states of every thread that are ready, standby, running, waiting, transition and terminated. There are priorities related to each thread that are divided into two categories that are variable class and real-time class. The priority of the threads in Windows XP is determined by 32 level priority systems. The priority of the variable class is from 0-15 and the priority for real-time class is 16-32. The priorities are managed by the dispatcher that queues the threads depending on the higher priority and ready thread. If the thread is not ready then the dispatcher will look for the ready thread neglecting the priority level of the thread. If there no ready thread then the dispatcher will initiate a thread called idle thread. The scheduling of the threads is determined on the state of the thread as well either the thread is ready or terminated. Moreover the priorities of the threads that are receiving strokes from I/O devices are more prior than the ones that are waiting for the disk memory allocation. It is good for increasing the responsive of Windows XP.

Here are some of the main difference between the Win 32 threads and POSIX Pthreads. The Win 32 thread can handle only one type of the thread however in POSIX Pthread each objected has its own data type. In POSIX Pthread, the objects have their functions and attribute while in Win32 threads there is need to define a function of each thread for its functionality.

 

Q3. Compare and contrast how Windows XP and Linux schedule processes.

If we talk about the scheduling of the process in the Linux then we find out that there are two algorithms for the scheduling processes one is time-sharing algorithm and the other one is real time tasks. The time-sharing algorithm is quite fair and preemptive when there are multiple processes to be executed. The time-sharing algorithm for process scheduler, there are basically two priority ranges in which the processes are executed. The first range is the real-time range that is from 0 to 99 while on the other hand, the other is nice value ranging that is from 100 to 140. The processes are also assigned the time quanta for each process. The time quanta are given to the processes on the basis of the priority level. The process with the higher priority level will be given long time quanta while the process with the lower priority level will be given short time quanta. The processes are managed in a way that the process that is executable and has time in its time slice, then it is considered to be active, while the process that is not left with any time slice is known as expired. The tasks that are exhausted because of no time slice will have to wait to be executed again till all the other active tasks are completed. It is like that the expired tasks are queued again and have to wait till all the active processes are complete. Once the active processes become exhausted and expire, the already expired tasks become active and the execution of these processes start again. On the other hand, the real time process scheduling in Linux is very simple and is further divided into two categories that are FCFS (First come first served) and the other one is round robin. In this real-time process scheduling there is no sharing of time only the task or processes with the higher priority will be executed earlier than those having lower priority. There is another difference in FCFS processes and round-robin process that is, in FCFS process scheduling, the process will not expire until it is completed while on the other hand the round-robin scheduling, the task will be queued in scheduling queue and the time sharing will take place between processes automatically.

If we look at the process scheduling of Windows XP, then we see that threads are executed, and the each threads will have a state that may be ready, standby, running, waiting, transition and terminated. Each state of the thread is important as it will let the processor execute it depending on the state of the thread. The thread with only ready state will be executed; other threads will have to wait until their status is changed to ready. However this procedure is a lot different than the process scheduling in Linux. The status of the process with the higher priority will be turned into standby, which will tell that the process is the next one to be executed by the processor. The process with the status is running and there are certain conditions that it will keep its status running that are, the process should preemptive by some higher priority process, in this case, the running process’s status will be changed to waiting and the active process will be executed. On the other hand, the process will be running until it is terminated completely. The process is considered to be in transition state when it is ready to be executed but is waiting for the available resources. The scheduling in Windows is done on 32 level priority scheme managed by the dispatcher, the priority from 0-15 is for variable class and 16-32 is for real time class. The dispatcher will queue all the process according to the higher priority level. The dispatcher will execute a special thread called idle thread in case if there is no thread available to be executed. An interesting thing about the scheduling in Windows XP is that if the there is a low priority level process being executed and the high priority level process becomes active, then the low level process will be preempted.

Q4. Compare and contrast the file system service and implementation of the ext file system on Linux and the NTFS on Microsoft Windows.

In Microsoft Windows XP, the basic files system that was used earlier from DOS is file allocation table also called FAT. However, there were certain problems in FAT that included 2GB storage, file fragmentation and lack of protection of files for the system. However the new version of FAT was FAT 32 that was helpful in solving in a number of issues that the already FAT system has been presenting like the fragmentation, size issues, recovery, large files, and multi data streams, encryption and volume shadow copies. However the basic file system of Windows XP is NTFS. In this case we will be dealing with NTFS files system of Windows XP, there are cases in which FAT 16 is still being used like for reading data from floppy disks and Windows 95, 98. When we talk about windows XP then we come to know that it also supports multiple file systems. Looking at the files system of Linux, it is eminent that it supports the file system of UNIX in which the file is not an object which should be stored on the disk storage or anywhere else like in a network, while  the stream of input and output in LINUX is considered to be a file. The files in the Linux are basically handled by the LINUX Kernel, and the process of handling file is hidden by the layer of software  that is called virtual file system (vfs).

Windows XP uses NTFS file management system whose basic entity is the volume. The file system in Windows XP is created by the disk management utility provided by the operating system, and the volume of the disk can be occupied in different ways like a complete volume or in partitions. The NTFS creates the files system by distributing the volume into clusters that are very small in size. The maximum size of a cluster in NTFS file system can be up to 512 MB. The reason is that the size of a cluster varies like 1kb size for 1GB,  and so on. The addressing of the file location in NTFS file system is done by the use of logical cluster number that usually numbers all the clusters in the files system covering from start to end. The files in NTFS files system is not a stream of bits but it’s a structured object that also contains certain attributes that may be common in other files as well like file name, creation time in simple words user data is stored in the attributes of the file. The attributes for each file in NTFS are very important and they can be accessed as well. The files in NTFS are described by records stored in an array in a file called Master File Table. The normal size of the record ranges from 1KB to 4KB. The small attributes of the files are stored in MFT and are called resident attributes while the large attributes are stored in contiguous extents and are called nonresident attributes.

The file system that is used by Linux is called ext2fs. There is a reason for using this file system as the files system in the early ages of Linux was Minix-compatible file system and the system was improved later on and in now known and ext2fs. This file system uses indirect method for locating the files by locating the data blocks that will be containing the information related to a specific file. There are three levels of indirection involved in it. The content of the files in ext2fs are stored in different method like in a file containing list of entries, and each entry contains the name of file, length of entry, the inode number to refer the file. All the space in ext2fs is stored in the different group of blocks that are further divided in order to contain the content and cover less memory of the storage. The information for a file in stored in a group of blocks that is similar. The groups will contain a super group and block group description table. The main difference between NTFS and ext2fs is that NTFS treats files as an objects and ext2fs considers stream of bits of inputs and outputs as file.