Computer Viruses in Operating System

A computer program known as a virus can be used to cause damage to another person's computer system by secretly installing the virus on that person's computer.

A computer virus is capable of performing any action that can be performed by a computer programmer.

The actions that a virus takes can either be annoying, such as typing a message, displaying an image, or playing some multimedia, or they can be harmful, such as erasing data, deleting files, modifying files, retrieving important information, and so on.

Your computer always faces an enemy in the form of a virus because viruses always carry out actions that you do not want.

This type of virus attack is also known as a "denial of service" attack. It is possible for a virus to render a computer system useless even while it is operating.

In order to carry out this type of denial-of-service attack, viruses typically use up system resources like the central processing unit (CPU) or pack the disc with useless data.

The following is an example of a simple virus program that can be used to destroy any UNIX system:


The method fork() is used to create a new process in the preceding code fragment. And, because I used 1 as the condition of the "while" loop, the loop always evaluates to true; thus, the method "fork()" continues to execute. This means that the process of creating the process is still running, which may cause your system to hang.

A computer virus has the potential to cause irreparable damage to the hardware of the computer.

As a consequence of this, the BIOS is now stored in flash ROM on virtually every computer. This enables the BIOS to be updated using software commands.

However, a computer virus can also write meaningless garbage into the flash ROM, which will prevent the computer from starting up in the future.

If a flash ROM chip is already installed in a socket, troubleshooting the issue will require opening up the computer system and replacing the flash ROM chip in question.

In the event that the flash ROM chip is soldered directly onto the mother board, it is possible that the board as a whole will need to be removed and replaced.

How Computer Virus Work ?

Let's take a look at an example to better comprehend the operation of a computer virus.

A computer programmer creates a virus program or virus code, which may be written in assembly language, in C language, or in any other programming language, and then inserts this virus code into a program on his own computer system. Viruses can spread from one computer to another in a variety of ways.

Now, the programmer who created the virus-containing program or the infected program is the one responsible for distributing it. This could be done by uploading it to the Internet or sending it to the victim's computer via e-mail, among other methods.

The next step is for the victim to download the virus-infected program, either directly from the internet or via an attachment in an email. Following the downloading and storage of the virus-infected program on the computer of the victim, the virus-infected program will then request to be executed. Now, when the victim clicks to execute or allows that virus-containing program to execute on their computer, the virus goes into action and begins performing the tasks that it is programmed to do on the computer of the victim.

This virus has the potential to steal some files, retrieve some important and private information, delete some files, modify some files, rename some files, and so on. This is the process that a computer virus goes through.

Viruses that Infect Executable Programs

The executable programs that are stored on a computer system are also susceptible to contamination from computer viruses.

Overwriting viruses are another name for viruses that can infect executable programs. These viruses, also known as executable program viruses, are capable of infecting executable programs.

Following is the infection logic of such a type of virus that can harm any executable program:

struct stat sbuf;
search(char *dir_name)
   DIR *dirptr;
   struct dirent *dptr;
   dirptr = opendir(dir_name);
   if(dirptr == NULL)
   while(TRUE) {
      dptr = readdir(dirptr);
      if(dptr == NULL) {
      if(dptr->d_name[0] == '.')
      Istat(dptr->d_name, &sbuf);
      if(chdir(dptr->d_name) == 0) {
      else {
         if(access(dptr->d_name, X_OK) == 0)

Boot Sector Viruses

"Boot sector viruses" are a type of computer virus that has the potential to cause catastrophic damage by erasing either the master boot record or the boot sector.

Device Driver Viruses

The term "device driver virus" refers to a specific type of computer virus that can infect a device driver.

How Computer Virus Spread ?

During this section, you have already gained an understanding of the operation of a computer virus.

First, you need to create the virus program, and then you need to drop or insert that virus program on any program that is known as a "infected program" or a "virus-containing program." Only then can you put a computer virus into working mode so that it can affect the computer of the victim.

Now, in order to put that virus-infected program into running mode, you need to disseminate that program so that you can find a victim to run it and get the necessary task completed through that virus.

There are a variety of methods that can be used to disseminate computer viruses, including uploading them to shareware websites, sending them as attachments in emails, etc.

Operating System Quiz

« Previous Topic »

Liked this article? Share it!

Like/follow us on social media for updates!