COMP 3000 Lab 2 2011: Difference between revisions

From Soma-notes
Line 9: Line 9:
# Look at /proc/cpuinfo in a Linux virtual machine (any distribution).  Is the "guest" CPU the same as that reported by the Windows "host"?
# Look at /proc/cpuinfo in a Linux virtual machine (any distribution).  Is the "guest" CPU the same as that reported by the Windows "host"?
# Examine the PCI devices as reported by the command line program "lspci" and identify the video card.  Is this "virtual" video card the same as "real" one that Windows uses?
# Examine the PCI devices as reported by the command line program "lspci" and identify the video card.  Is this "virtual" video card the same as "real" one that Windows uses?
# Compile the following program with <tt>gcc -O hello.c -o hello-dyn</tt> and then run it using the command <tt>ltrace ./hello-dyn</tt> .  What dynamic functions does the program call?
# Compile the program hello.c (below) with <tt>gcc -O hello.c -o hello-dyn</tt> and then run it using the command <tt>ltrace ./hello-dyn</tt> .  What dynamic functions does the program call?
# Compile the same program with <tt>gcc -O -static hello.c -o hello-static</tt> .  Run this second binary with ltrace as before.  What dynamic functions does the program now call?
 
  /* hello.c */
  /* hello.c */
  #include <stdio.h>
  #include <stdio.h>
  #include <unistd.h>
  #include <unistd.h>
 
  int main(int argc, char *argv[])
  int main(int argc, char *argv[])
  {
  {
         printf("Hello, world!\n");
         printf("Hello, world!\n");
         return 0;
         return 0;
  }
  }
# Compile the same program with <tt>gcc -O -static hello.c -o hello-static</tt> .  Run this second binary with ltrace as before.  What dynamic functions does the program now call?


==Part B (on your own)==
==Part B (on your own)==

Revision as of 03:18, 26 September 2011

Part A (Mandatory)

This part is to be completed in class.

  1. Copy the ISO images from the class DVD to your computer. Boot at least two of the ISOs in Virtualbox or VMware Player by creating a new virtual machine and using the ISO for the virtual CD drive. For at least two distributions:
    1. Roughly how long did the VM take to boot completely?
    2. How similar is the environment to that available on the Lambda SCS hosts?
  2. Create an account on the class wiki. What username did you choose?
  3. Look at /proc/cpuinfo in a Linux virtual machine (any distribution). Is the "guest" CPU the same as that reported by the Windows "host"?
  4. Examine the PCI devices as reported by the command line program "lspci" and identify the video card. Is this "virtual" video card the same as "real" one that Windows uses?
  5. Compile the program hello.c (below) with gcc -O hello.c -o hello-dyn and then run it using the command ltrace ./hello-dyn . What dynamic functions does the program call?
  6. Compile the same program with gcc -O -static hello.c -o hello-static . Run this second binary with ltrace as before. What dynamic functions does the program now call?
/* hello.c */
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
       printf("Hello, world!\n");
       return 0;
}

Part B (on your own)