20135202 Shang, 20135220 talk about sensitivity-Experiment 2

Source: Internet
Author: User

Beijing Institute of Electronic Technology (BESTI)

Real Inspection report

Course: Information Security system Design Basic class: 1352

Name: Talk about Min, Shang

School Number: 20135220,20135202

Score: Instructor: Lou Jia Peng Experimental Date: 2015.11.17

Experiment level: Preview degree: Experiment time: 15:30-18:00

Instrument Group: Compulsory/Elective: compulsory Test number: 2

Experiment Name: multithreaded Application design and serial port programming

Experimental purposes and Requirements:(1) understand the basic principles of multi-thread programming.            

( 2 ) Learn pthread the use of library functions.                                 

( 3 ) Understand the Linux the basic method of serial programming in the environment.                       

( 4 ) Master the main properties of the terminal and set up methods, familiar with the terminal I/O the use of functions.

( 5 Learn to use multi-threading to complete the serial processing of the transceiver.                                                          

Experimental instrument:

Name

Model

Number

Arm

Up-tech

1

PC Machine

Xp

1

Virtual machines

REDHAT

1

Experiment contents, steps and experience:

    1. The understanding of the experiment process, the understanding of the knowledge point in the experiment instruction book.

(1) Multithreaded application design

The experiment code realizes the relationship between the producer and the consumer, they share the same buffer, the producer can write the data to the inside, and the consumer can read the data from it. One of the first questions is how to determine whether the producer performs the writing or the consumer performs the reading?

By first acquiring a mutex, the lock is guaranteed to be one of only two behaviors, but not at the same time. Then for the write or read out can proceed smoothly, the first to determine the buffer, if the buffer is full can not be written, the buffer space can not be read out.

In the experiment, first compile and run in the Redhat virtual machine, then use NFS to map the executable file to the arm machine. ARM machine configuration and Mapping and experiment 1 the same, it should be noted that the path can not blindly follow the guidance book, but to follow their own actual path to write.

(2) Serial port programming

This is to distinguish between two threads, the sending thread and the receiving thread, and then the main function to complete the opening of the serial device, terminal property settings and so on. Because already gave the code and the instruction book, the understanding is relatively simple, this experiment is to help us to acquaint with the serial port's series of settings and the code implementation, the comparison is not good to understand is not previously met the head file and the function, for explanation detailed view can.

    1. The problems encountered during the experiment and the solutions. (Below is just an example, you can write less, you can add other problems and workarounds you encountered)

(1) Make cannot be used

The experiment is relatively simple, there is no big problem, mainly make can not use the problem, this is due to the setting of environment variables in the makefile and different in this machine, two solutions, one is to change the environment variables, this is done with the help of others And the second is to manually compile directly. We chose to compile directly, because this compilation is relatively simple.

(2) Port settings

In the second experiment, the following error occurred while running the term:

/dev/ttys0:no such file or directory

This is solved according to the instruction book method:

[/mnt/yaffs] Cd/dev

[/dev] ln–sf/dev/tts/0 ttyS0

This is because in Linux under the serial port file is located in/dev, generally in the old version of the kernel serial port one is/DEV/TTYS0, serial port Two for/dev/ttys1, and in the Development Board serial port device is located in/dev/tts/, because the development Board does not ttyS0 this device, So we're going to build a connection.

Another host connected to the serial 2 to send and receive the test also occurred similar error, need to establish the following connection:

[/mnt/yaffs] Cd/dev

[/dev] ln–sf/dev/tts/0 ttyS0

[/dev] ln–sf/dev/tts/1 ttyS1

3. Experience

This experiment from the concrete implementation is not difficult, because the guidance book has been given very detailed, the code itself, code interpretation and the possible problems and solutions have been given, only need to step-by-step completion. However, there are some difficulties in the understanding of the code content, from the theory to the extension of the code, the implementation of multi-threaded and serial port and the code itself, is more important than the experimental process step by step retrace go down.

20135202 Shang, 20135220 talk about sensitivity-Experiment 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.