When do we use "of" rather than " 's" to show possession? [duplicate]

Solution 1:

My English professor told me that we use of when we are talking about something that is part of or related to another thing. For example, ceiling of my room or subject of the lecture. But 's is used when we are speaking about the ownership relationships and usually related to a person. For example Ali's car or students' room.

But according to my researches, we use of to indicate that one thing is either related to or about something else. On the other hand we use 's to show that two or more things are part of or under the ownership of each other in some ways.