1 / 22

A user level multi-threaded Particle simulator

A user level multi-threaded Particle simulator. Supervisor: Joe Cordina Observer: Kurt Debattista. APT. Advanced practical task serve the purpose of allowing students to design, implement and document a medium to large project Student initiative Understand task + design

liluye
Télécharger la présentation

A user level multi-threaded Particle simulator

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A user level multi-threaded Particle simulator Supervisor: Joe Cordina Observer: Kurt Debattista

  2. APT • Advanced practical task serve the purpose of allowing students to design, implement and document a medium to large project • Student initiative • Understand task + design • Research into possible solutions • Work alone under supervisor’s guidance User LevelMulti-threaded Particle simulator

  3. Overview • Designing and implementing a user-level multi-threaded particle-in-a-box simulator. User LevelMulti-threaded Particle simulator

  4. Literature • Operating Systems II and Concurrent and Distributed Systems Slides • Any basic mathematics textbook • Any basic physics textbook User LevelMulti-threaded Particle simulator

  5. Assessment • 50% Design/Implementation • 30% Documentation/Inception Report • 20% Presentation/Interview User LevelMulti-threaded Particle simulator

  6. Main issues of APT • Implementation • Learn how to use Mesh • Provide a multi-threaded particle simulator • 2D view of particles • Provide example scenarios • Calculate basic physics constants • Benchmark your algorithms User LevelMulti-threaded Particle simulator

  7. Mesh • Mesh is an advanced very fast user-level multi-threaded library written in C for CERN (Linux). • It is user-level and thus we will try not to make use of system calls as much as possible. • Memory requirements concerns will be of major focus. User LevelMulti-threaded Particle simulator

  8. Mesh (cont.) • Your main header files are Mesh.h and Scheduler.h • Main function provided by void Main(Thread* p, int argc, char** argv); void Exit(int code); • A large selection of function calls are available to allow thread manipulation • Note that threads can also have a priority User LevelMulti-threaded Particle simulator

  9. Mesh (cont.) • #define Thread_Constructor(F,X...)Scheduler_ThreadConstructor((ThreadMain)(F),X) • void Thread_Destructor(Thread*); • void Thread_Stop(void); • void Thread_Exit(void); • void Thread_NewPriority(int priority); • void Thread_SetPriority(Thread* p,int priority); • int Thread_GetPriority(void); • void Thread_Yield(void); • void Thread_Preempt(void); • void Thread_Join(Thread* process,...); • void Thread_Spawn(Thread*,int priority); • void Thread_Run(Thread*); • void Thread_Runs(Thread* process,...); • void Thread_Par(Thread* process,...); • void Thread_PriPar(Thread* process,int priority,...); • void Thread_SleepUntil(RealTime t); • void Thread_Sleep(RealTime t); • Thread* Scheduler_ThreadConstructor(ThreadMain main,int stack_size,int narguments,...); User LevelMulti-threaded Particle simulator

  10. Particle Simulator • Using the threads package you will simulate the behavior of physical particles in a box. • Threads are ideal where each thread performs small amounts of calculation • Thus define box dimensions and let the particles loose in it starting from a random position. User LevelMulti-threaded Particle simulator

  11. Particle Simulator (cont.) • Particles in physics have a well defined behavior • Assume that all particles are point particles • When they collide with a wall their angle of reflection equals angle of incidence. • Each particle has a mass and a velocity (speed with direction) User LevelMulti-threaded Particle simulator

  12. Particle Simulator (cont.) • Motion is governed by sx = x + v * t * cos a sy = y + v * t * sin a where sx is distance in x direction sy is distance in y direction v is velocity t is time a is the direction angle User LevelMulti-threaded Particle simulator

  13. Particle Simulator (cont.) • Particles can also collide with each other • Yet particles have also momentum and physics say that initial momentum should equal final momentum in a collision. • Equations given with handouts • Be careful when calculating theta to get final angle • One of the main task is an efficient collision detection between the particles User LevelMulti-threaded Particle simulator

  14. 2D view of particles • You will be using the svgalib man svgalib will tell you all • Compile using gcc –lvga vga_init(); vga_setmode(G640x480x256); • Then you can use • int vga_drawpixel(int x, int y); User LevelMulti-threaded Particle simulator

  15. 2D view of particles • The display should be synchronized to 60 frames a second (Bonus). • Make your program decrease the frames per second depending on the load in the computer. • For timing you can use the RealTime Library. User LevelMulti-threaded Particle simulator

  16. Basic Physics constants • You can calculate the average speed of the particles, the speed distribution and the velocity distribution. • You can calculate the temperature visible produced by your particles in real-time and you can compare it to the ideal one. • The mean Kinetic Energy has to remain constant in a closed box • When numbers are very large <K> =(mvx2) / N User LevelMulti-threaded Particle simulator

  17. Bonus Material • Construct multiple scenarios • Multiple boxes next to each other where each border can store part of the energy of one collision and then pass it on to the next particle that hits it • A leaky box, where if a particle has energy above a certain value, it will escape away • 3D equations and visualization of the system • Hot walls which transfer constant energy to the particles but particles which have larger energy will still escape • Dampening effect in the box • Others you might think of or discussed with me • Optimisation techniques on the algorithms • Producing graphs of physics constants with time User LevelMulti-threaded Particle simulator

  18. Benchmarking • Use the RealTime library to be able to benchmark the efficiency of your algorithms. • This will give you time delays in the order of s. User LevelMulti-threaded Particle simulator

  19. Documentation • Inception report (Friday 1st March) • Analysis/Design • Work plan • Report • Detailed analysis of problem • Discussion of solution (+ others considered) • Detailed description of data structures and algorithms used User LevelMulti-threaded Particle simulator

  20. Presentation • 15 minute presentation • Material Content • Knowledge of subject • Clarity • Interview • Answer questions related to APT User LevelMulti-threaded Particle simulator

  21. Interaction • Expect to report to supervisor every other week:Friday • Who cannot attend must mail in progress report + work in progress demo • First meeting Friday 1st March User LevelMulti-threaded Particle simulator

  22. The end • All the best! • Good luck! • Work hard! User LevelMulti-threaded Particle simulator

More Related