Operating System Functions Must To Know

Operating System Functions Must To Know

The operating system is the software that manages your computer’s hardware and allows you to access programs. It also handles tasks such as running your email, updating your apps, and sending notifications. But it’s not just the OS that is important; there are other functions involved in getting things done on computers, too!

Operating System That Do Nothing

There are a number of operating system functions which do nothing. While they appear to be doing something, they actually don’t. These include:

  • getenv() – Returns the value of an environment variable or sets it to a new value if given one.
  • getcwd() – Returns the current working directory pathname as defined by your shell (the program that interprets and executes your commands).
  • getpid() – Gets process identifier (PID) associated with current process; can be used to kill other processes running on the same machine or daemonize yourself into background mode so you don’t have to worry about closing down later!

Single Most Common Functions 

The single most common operating system functions I see are GetCurrentProcessId, GetCurrentThreadId, and GetLastError. These three functions allow you to easily identify the current process or thread that’s running in your application. GetCurrentProcessId returns a long integer value representing the identifier of your process’ current thread; this can be useful when trying to figure out which thread has caused an exception or crash because it’s easy to determine whether it’s part of your own code or not (for example: if it was spawned by another program). GetCurrentThreadId does exactly what you would expect, it gives you access to information about whatever thread is currently running inside your application!

Get Environment Variables

The first step to getting and setting an environment variable is to use the GetEnvironmentVariable function. This function takes in a name of an environment variable and returns its value, which you can then store in a variable for later use. Let’s say we want our program to get the value of an environment variable called “MYENV”.

First, we’ll create a new instance of Windows: EnvironmentVariables, which contains all of the information about all of your system’s environment variables. Then we call GetEnvironmentVariable(“MYENV”); in that instance, passing MYENV as its argument. Now that we have access to this information through our class’ member functions (such as GetValue), let’s set up another instance where we can change what values come back from GetValue(). If we don’t do this before calling GetValue(), then everything will default back into place after every run!

Get Command Line Arguments

In this example, we’ll use the operating system function getopt to get the command line arguments. The first argument to getopt is a string that represents the options we want to parse and process. In this case, it’s “-a” or “-b” or something else that matches an option on our command line.

The second argument is a pointer to an array of char** (char pointers). This will be filled with pointers to arrays of strings containing all of our command line arguments in order from left to right when your program runs as if they were passed as normal positional parameters: first “-a”, then “-b”, etc.

Get Current Directory Path

The os module contains functions that are useful for interacting with the operating system. One of these, getcwd(), gets the current working directory path of your program. This can be used to change directories and move around in your filesystem.

getcwd() returns a string representing your current working directory (which may not be the same as the one you started out in). It’s important to note that this function doesn’t actually change where you are; it just returns an existing path or creates one if there isn’t already one there! To change directories from within Python code, use chdir().


The operating system is the most important software for your computer. It controls everything from how fast programs run, to how much memory each program has access too. The operating system also handles all types of hardware on your computer such as the keyboard and mouse or graphics card etc.