Question

In: Computer Science

a) b) c) Compare and contrast systems programming in Windows as against systems programming in Unix/Linux....


a)
b)
c)
Compare and contrast systems programming in Windows as against systems programming in Unix/Linux.
CR, 8
Explain the term structured exception handling (SEH) as used in systems programming and give a practical example of how it can be used to handle errors in a block of code. AP, 7
Write a C/C++ system program to delete an unwanted file in the Windows file system. Compile and run the program and copy the source code into your answer booklet. CR,10


Solutions

Expert Solution

c. Windows   Linux

Cost The latest Windows operating system has different versions and wide range of pricing options. Most Linux distributions are free of cost (at least for private users).
Licensing model Proprietary software. The Linux kernel and most of the distributions are open source and available under a GNU General Public License (GPU).
User-friendliness From the outset, Windows was designed to be as simple to use as possible, even for users with no IT knowledge. While it’s true that Ubuntu in particular is relatively easy for Windows users to grasp, with most of the other Linux distributions, there are significant barriers to entry for newcomers.
Graphical user interface Microsoft set standards with its Windows GUI. Users of Linux distributions have many freedoms in designing the GUI and can even do away with it altogether.
Support Windows offers a large range of support services, both within the system and online. There is also comprehensive specialist literature available aimed at users with various levels of knowledge. Linux support comes from the extensive user community. You can find an answer to almost every problem in the online forums and Wikis.
Software Most software released is compatible with Windows. There are far fewer applications designed specifically for Linux, although some Windows programs can run on Linux.
Installing programs Programs are installed by downloading them from websites or from physical storage media. In Linux, the majority of programs, drivers and packages are supplied via fixed repositories.
Uninstalling programs When programs are uninstalled, some components remain on the system. In Linux, programs are always completely removed.
Hardware Windows drivers are available for almost any hardware. Hardware support is more limited. Some drivers are not available immediately.

CR 8. Structured exception handling enables you to have complete control over the handling of exceptions, provides support for debuggers, and is usable across all programming languages and machines. Vectored exception handling is an extension to structured exception handling.

#include <string.h>
#include <stdio.h>
#include<windows.h>

void foo (FILE * fileDescr)
{
char c[12];
long lSize;
int mySecretNumber;

fseek (fileDescr , 0 , SEEK_END);
lSize = ftell (fileDescr);
rewind (fileDescr);

fread(c, 1, lSize, fileDescr);
mySecretNumber = atoi(c);

__try
{
mySecretNumber = mySecretNumber / mySecretNumber;
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
printf("In the exception handler");
}
}

int main (int argc, char **argv)
{
FILE * fileDescr = NULL;

if(fileDescr = fopen(argv[1], "r"))
{
foo(fileDescr);
fclose(fileDescr);
}
}

CR 10.

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
   clrscr();
   int status;
   char fname[20];
   cout<<"Enter name of file, you want to delete : ";
   gets(fname);
   status=remove(fname);
   if(status==0)
   {
       cout<<"file "<<fname<<" deleted successfully..!!\n";
   }
   else
   {
       cout<<"Unable to delete file "<<fname<<"\n";
       perror("Error Message ");
   }
   getch();
}

Hope this helps you. Please give an upvote. Thank you.


Related Solutions

Consider Unix, Linux, MacOS, Android and Windows operating systems. Consider the primary application of each in...
Consider Unix, Linux, MacOS, Android and Windows operating systems. Consider the primary application of each in the marketplace. How does each OS implement threads? How does the usage of threads impact application (usage) ?
Linux Directories, File Properties, and the File System in C Understanding Unix/Linux Programming Your version of...
Linux Directories, File Properties, and the File System in C Understanding Unix/Linux Programming Your version of mv command The mv command is more than just a wrapper around the rename system call. Write a version of mv that accepts two argument. The first argument must be the name of a file, and the second argument may be the name of a file or the name of a directory. If the destination is the name of a directory, then mv moves...
Systems Programming in Linux using C Remake the version of the ls -ialR command in C.....
Systems Programming in Linux using C Remake the version of the ls -ialR command in C.. In this version of ls, you must also consider symbolic file types. Make sure you have file header comments and function header comments. Also, write inline comments whenever necessary.
Systems Programming - File Operations Create your version of the tail command in Linux using C...
Systems Programming - File Operations Create your version of the tail command in Linux using C The lseek system call allows you to move the current position anywhere in a file. The call lseek(fd, 0, SEEK_END) moves the current position to the end of the file. The tail command displays the last ten liens of a file. Try it. tail has to move, not to the end of the file, but to a spot ten lines before the end of...
What have been the major changes in the file systems for Windows and for Linux?
What have been the major changes in the file systems for Windows and for Linux?
Differences Between Linux and Windows Operating Systems Two key differences between a Linux operating system and...
Differences Between Linux and Windows Operating Systems Two key differences between a Linux operating system and a Windows operating system are the concepts of “mounting” and “drive” letters. Provide an example for each. Why is it important to plan disk partitioning before installing Linux? Discuss the advantages of disk partitioning. Also discuss what logical volume management (LVM) is and why or why you might use it.
Contrast the behavior of windows OSs with regard to group membership concurrently with the Linux approach...
Contrast the behavior of windows OSs with regard to group membership concurrently with the Linux approach of single group membership at a moment in time. How does this approach effect cumulative group permissions in Linux?
Systems Programming - File Operations in Linux using C Preventing copying the same file What does...
Systems Programming - File Operations in Linux using C Preventing copying the same file What does the standard cp do if you try to copy a file onto itself? $ cp file1 file1 cp: 'file1' and 'file1' are the same file Modify cp1.c to handle the situation and include comments. /** * @file cp1.c * @brief Uses read and write with tunable buffer size * usage: cp1 src dest */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #define BUFFERSIZE...
please write in c using linux or unix Write a program that will simulate non -...
please write in c using linux or unix Write a program that will simulate non - preemptive process scheduling algorithm: First Come – First Serve Your program should input the information necessary for the calculation of average turnaround time including: Time required for a job execution; Arrival time; The output of the program should include: starting and terminating time for each job, turnaround time for each job, average turnaround time. Step 1: generate the input data (totally 10 jobs) and...
Please write in C using linux or unix. Write a program that will simulate non -...
Please write in C using linux or unix. Write a program that will simulate non - preemptive process scheduling algorithm: First Come – First Serve Your program should input the information necessary for the calculation of average turnaround time including: Time required for a job execution; Arrival time; The output of the program should include: starting and terminating time for each job, turnaround time for each job, average turnaround time. Step 1: generate the input data (totally 10 jobs) and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT