If you haven't alreadyĬompiled and run the base system, as described in the introduction Some of this code might seem slightly mysterious. Primitives (semaphores, locks, condition variables, and optimization Pintos already implements thread creation and thread completion,Ī simple scheduler to switch between threads, and synchronization The first step is to read and understand the code for the initial thread Skim the material from A.1 Loading through A.5 Memory Allocation, especially A.3 Synchronization. Compilation should be done in the threads directory.īefore you read the description of this project, you should read all of This assignment, with some work in the devices directory on the You will be working primarily in the threads directory for Your job is to extend the functionality of this system to gain aīetter understanding of synchronization problems. In this assignment, we give you a minimally functional thread system. It’s up to you.Pintos Projects: Project 2-Threads You can make them a one-to-one mapping, so that the same values in both identify the same process, or you can use a more complex mapping. You can choose whatever suitable types you like for tid_t and pid_t. It is used by user processes and the kernel in the exec and wait syscalls. It is a data type used only in the kernel. What’s the difference between tid_t and pid_t?Ī tid_t identifies a kernel thread, which may have a user process running in it (if created with process_execute) or not (if created with thread_create). Can I run user programs under a debugger? Notably, the Pintos user program C library does not have a malloc implementation. It will probably take at least some porting effort to make it work under Pintos. The chances are good that the library you want uses parts of the C library that Pintos doesn’t implement. Pintos does not support as rich a syscall interfaces as real operating systems (e.g., Linux, FreeBSD), and furthermore, uses a different interrupt number (0x30) for syscalls than is used in Linux (0x80). If the library makes syscalls (e.g, parts of the C standard library), then they almost certainly will not work with Pintos. Not all functions do, of course, but usually the library is compiled as a unit. The C library must be built specifically for the operating system (and architecture), since it must make syscalls for I/O and memory allocation. It does not include many of the features that are expected of a real operating system’s C library. The C library we provide is very limited. Why do many C include files not work in Pintos programs? Can I use libfoo in my Pintos programs? You can use GDB’s codedisassemble command to disassemble individual functions. The objdump (80x86) or i386-elf-objdump (SPARC) utility can disassemble entire user programs or object files. Until you have implemented syscalls sufficiently, you can use hex_dump to check your argument passing implementation (see Startup). The default syscall handler just handles exit(). Notably, printf invokes the write syscall. Every reasonable program tries to make at least one syscall ( exit) and most programs make more than that. You’ll have to implement syscall before you see anything else. All my user programs die upon making a syscall. If the stack isn’t properly set up, this causes a page fault. The basic C library for user programs tries to read argc and argv off the stack. This will happen if you haven’t implemented argument passing (or haven’t done so correctly). All my user programs die with page faults. See the comment underneath the kernel stack diagram in threads/thread.h about the importance of keeping your struct thread small. It’s also possible that you’ve made your struct thread too large. If you’re allocating large structures or buffers on the stack, try moving them to static memory or the heap instead. This happens when you overflow your kernel stack. The kernel always panics with assertion is_thread(t) failed. Is the file system full? Does the file system already contain 16 files? The base Pintos file system has a 16-file limit. Is your file name too long? The file system limits file names to 14 characters. The kernel always panics when I run a custom test case.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |