CS2850 Operating Systems Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is Valgrind?

A

Valgrind is a debugging tool that acts like a virtual machine.

It intercepts all the memory accesses of your program and ensures you aren’t doing anything obviously wrong.

Much like Java will throw an “Index out of bounds” exception if you try to go outside of an array, Valgrind will report when your program is accessing garbage values in memory or leaking memory.

Because Valgrind only monitors a single run of your program it cannot guarantee that your code is perfect, but it will catch a lot of errors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is gcc?

A

GCC isa free and open source compiler collection for C, C++, and other languages, written for the GNU operating system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is clang?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a macro in C?

A

A macro is a fragment of code that is given a name. You can define a macro in C using the #define pre-processor directive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does #include <stdio.h> do in C?

A

It looks for the stdio.h file and effectively copy-pastes it in the place of this#includestatements. This file contains so-called function prototypes of functions such asprintf(),scanf(), … so that compiler knows what are their parameters and return values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is struct in C?

A

Structures in C (struct) are equivalent to classes in other languages.

Note, with structures, members are public by default.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a segfault error?

A

A segfault error occurs when a program tries to access memory that it doesn’t own.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the -g2 flag do when compiling a file?

A

The -g2 flag tells the compiler to add extra information to the executable (such as line numbers.)

One reason this is useful is that it allows debugging tools can relate memory addresses to line numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a leaked memory error?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an Invalid Memory Read error?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Cygwin?

A

Cygwin is a project that provides a large collection of GNU and Open Source tools and a DLL that emulate Linux functionality on Windows . It is a Linux-like environment for Windows that allows you to run Linux commands and programs on your Windows system . You can install, use, and update Cygwin packages, verify the signature of setup-x86_64.exe, and choose the minimal base packages or the full Cygwin distribution .

Source: Conversation with Bing, 12/12/2023
(1) Cygwin. https://cygwin.com/.
(2) Cygwin - Wikipedia. https://en.wikipedia.org/wiki/Cygwin.
(3) Cygwin Installation. https://cygwin.com/install.html.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Give examples of features that C does not include

A

C does not include:

  • operators acting on composite objects such as a string of characters, an array, or lists
  • dynamical memory allocation facility
  • READ or WRITE statements
  • built-in file access methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is ANSI C?

A

ANSI C is a standard version of C:

  • a set of rules have been fixed for C-programs to be machine-independent and compatible
  • the same C code can work on computers with different operating systems
  • what changes is how .c files are run i.e. the corresponding executable (binary) program
  • the binary file obtained from a .c source file, is produced by a system-dependent compiler
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is an array and what problem does malloc() solve?

A

An array is a collection of a fixed number of values. Once the size of an array is declared, you cannot change it.

Sometimes the size of the array you declared may be insufficient. To solve this issue, you can allocate memory manually during run-time. This is known as dynamic memory allocation in C programming.

To allocate memory dynamically, library functions are malloc(), calloc(), realloc(), and free().

These functions are defined in the <stdlib.h> header file.</stdlib.h>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly